Linux install command - install or upgrade software or back up data

The Linux install command is used to install or upgrade software or back up data.

Linux install command Function Description

Use the install command to copy files and set attributes. In the first three forms of the following command syntax, copy source files to a target file or copy multiple source files to a pre-existing directory while setting their ownership and permission modes. In the fourth form, create gives all the components in the target directory.

The install command is used to install or upgrade software or back up data, and it is used by all users. install is similar to the cp command in that both can copy files/directories to a specified location. However, install allows you to control the properties of the target file. install is usually used in a program’s makefile, which is used to copy the program to the target (installation) directory.

Linux install command Syntax

install [option] [-T] [source] [target]
install [options] [source] [directory]
install [options] -t [directory] [source file]
install [option] -d [directory]

The meaning of each option in the command is shown in the table –

Option Description
-c Compare each set of source and target files, in some cases without modifying the target files
-d Treat all parameters as directory names and create all components for the specified directory
-D Create all necessary parent directories of the target directory and copy the source files to it
-g Set the group to which you belong, not the group to which the process currently belongs
-m Set your own permission mode (like chmod), not rwxr-xr-x
-o Custom owner (Superuser only)
-p Modify the access/modification time of the source file to be consistent with the target file
-s Unpack the symbol table
-S Overwrites the suffix of a common backup file
-t Copies all parameters of the source file to the specified directory
-T Treat the target file as a normal file
-v Display the name of the directory when you create it

Linux install command Examples

Create /root/apidemos folder

install -d /home/deepinout/apidemos

Output:

Linux install command

Copy the /root/install.log file to the /root/www folder

[root@rhel ~]# install /root/install.log /root/www

Copy the /root/install.log file to the /root/www folder and rename it to qq

[root@rhel ~]# install /root/install.log /root/www/qq

Copy the /root/install.log file to /root/www/ss file and set the permission to 644

[root@rhel ~]# install -m 644 /root/install.log /root/www/ss

Copy the /root/install.log file to the /root/ppp/bb file if there is no /root/ppp directory

[root@rhel ~]# install -D /root/install.log /root/ppp/bb

Modify the access/modification time of the source file /root/install.log to be the same as the target file /root/www/ooo

[root@rhel ~]# install -p /root/install.log /root/www/ooo

useful option -D:

install -D x a/b/c
The effect is similar to:
mkdir -p a/b && cp x a/b/c
install [option] SOURCE [SOURCE...] DIRECTORY

Copy multiple SOURCE files to the destination directory:

install a/* d

where d is the directory.

Like(1)

Related

Linux Login Logout Command
Linux login commandLinux logout commandLinux nologin commandLinux exit commandLinux sulogin commandLinux rlogin commandLinux poweroff commandLinux ctrlaltdel CommandLinux shutdown commandLinux halt commandLinux reboot commandLinux init commandLinux runlevel commandLinux telinit command
Linux File Management Command
Linux cat commandLinux tac commandLinux nl commandLinux more commandLinux less commandLinux head commandLinux tail commandLinux rev commandLinux fold commandLinux fmt commandLinux expand commandLinux pr commandLinux sort commandLinux uniq commandLinux cut commandLinux comm commandLinux diff commandLinux join commandLinux diff3 commandLinux cmp commandLinux colrm commandLinux paste commandLinux mkdir commandLinux tr commandLinux split commandLinux csplit commandLinux tee commandLinux unexpand commandLinux patch commandLinux awk commandLinux sed commandLinux od commandLinux pwd commandLinux cd commandLinux ls commandLinux dir commandLinux dirs commandLinux touch commandLinux rmdir commandLinux cp commandLinux mv commandLinux rm commandLinux install commandLinux tmpwatch commandLinux file commandLinux du commandLinux wc commandLinux tree commandLinux cksum commandLinux md5sum commandLinux sum commandLinux dirname commandLinux mkfifo Command
Cron Expressions
Cron Expression to Run Every Day at 12 PMUnderstanding Vue Cron ExpressionsUnderstanding JS Cron ExpressionsA Comprehensive Guide to Cron Expressions for Scheduled TasksUnderstanding Linux Cron ExpressionsUnderstanding Quartz Cron ExpressionsCron ExpressionCron Time ExpressionCron Expression ParsingCron Expression: Executing a Task Every SecondCron Expression for Every Minute ExecutionCron Expression to Execute Every 10 MinutesCron Expression: Executing Every HourCron Expression to Execute Once a YearCron Expression: How to Schedule a Task to Run Daily at Midnight?