Install command in Linux

Time:2019-10-8

Install commandIts role is to install or upgrade software or backup data, and its permission is for all users. The install command andcpSimilar to commands, files/directories can be copied to a specified location. However, install allows you to control the properties of the target file. Install is usually used for making files of programs, which are used to copy programs to the target directory.

grammar


install [OPTION]... [-T] SOURCE DEST
install [OPTION]... SOURCE... DIRECTORY
install [OPTION]... -t DIRECTORY SOURCE...
install [OPTION]... -d DIRECTORY...

In the first two formats, the < source > will be copied to < destination > or multiple < source > files will be copied to the existing < Directory > while setting the permission mode and owner/group. In the third format, all specified directories and their home directories are created. The parameters that must be used for long options are also necessary when using short options.

option

Backup [= CONTROL]: Backup every existing destination file.
- b: Similar -- backup, but no parameters are accepted.
- c:(This option is not processed).
- d,--directory: All parameters are processed as directories, and all home directories of the specified directory are created.
- D: Create all home directories before Destination, then copy Source to Destination; useful in the first usage format.
- g, -- group = group: Set the group to which the process belongs, rather than the current group to which the process belongs.
- m, - mode = mode: Set the permission mode (like chmod) by yourself, not rwxr-xr-x.
- o, - owner = owner: Set the owner by yourself (only for superusers).
- p,--preserve-time stamps: The access/modification time of the <source> file is used as the time attribute of the corresponding destination file.
- s,--strip: Delete the symbol table with the strip command, only for the first and second usage formats.
- S, - suffix = suffix: specify the <suffix> of the backup file by yourself.
- v,--verbose: Print the name when processing each file/directory.
--help: Display this help information and leave.
--version: Display version information and leave.

Example


install -d [option] DIRECTORY [DIRECTORY...]

Support multiple, similarmkdir -pSupport recursion. For example:install -d a/b/c e/fResults andmkdir -p a/b/c e/fSame.


install [option] SOURCE DEST

Copy SOURCE file (test cannot be directory) to DESTfile(Documents):

install a/e c
The results are similar:
CP a/e c# Note that C must be a file.

Useful options-D

install -D x a/b/c
The effect is similar:
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.

summary

The above is the Install command in Linux introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave a message for me. Xiaobian will reply to you in time. Thank you very much for your support to developpaer.