install command in Linux with examples
install command is used to copy files and set attributes. It is used to copy files to a destination of the user’s choice, If the user want to download and install a ready to use package on GNU/Linux system then he should use apt-get, apt, yum, etc depending on their distribution.
install [OPTION]... [-T] SOURCE DEST install [OPTION]... SOURCE... DIRECTORY install [OPTION]... -t DIRECTORY SOURCE... install [OPTION]... -d DIRECTORY...
Here, the first three forms are used to copy the SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY while setting permission modes and owner/group. But the fourth form is used to create all components of the given DIRECTORY.
- –backup[=CONTROL] : This option is used to create a backup of each existing destination file.
- -b : Like –backup but It will not accept an argument.
- -C, –compare : Used to compare each pair of source and destination files. But in some cases it does not modify the destination.
- -d, –directory : It will act as directory names towards all arguments. And create all components of the specified directories.
- -g, –group=GROUP : Used to set group ownership, instead of processing the current group.
- -m, –mode=MODE : Set permission mode (as in chmod).
- -o, –owner=OWNER : Set ownership (super-user only).
- -p, –preserve-timestamps : Apply access/modification times of SOURCE files to corresponding destination files
- -t, –target-directory=DIRECTORY : Copy all SOURCE arguments into DIRECTORY.
- -T, –no-target-directory : Treat DEST as a normal file.
- -v, –verbose : Used to show the name of each directory as it is created.
- –help : Display the help message and exit.
- –version : Shows the version information and exit.
- Copies two files rocket.c and rocket to directory demo.
- Compare and copies files(observe the difference).
- Using -T option(observe that it makes a file instead of directory).
- Changing owner and permissions.
- Printing version information.