Next: , Previous: dd invocation, Up: Basic operations


11.3 install: Copy files and set attributes

install copies files while setting their file mode bits and, if possible, their owner and group. Synopses:

     install [option]... [-T] source dest
     install [option]... source... directory
     install [option]... -t directory source...
     install [option]... -d directory...

install is similar to cp, but allows you to control the attributes of destination files. It is typically used in Makefiles to copy programs into their destination directories. It refuses to copy files onto themselves.

The program accepts the following options. Also see Common options.

-b
--backup[=method]
See Backup options. Make a backup of each file that would otherwise be overwritten or removed.
-c
Ignored; for compatibility with old Unix versions of install.
-d
--directory
Create any missing parent directories, giving them the default attributes. Then create each given directory, setting their owner, group and mode as given on the command line or to the defaults.
-g group
--group=group
Set the group ownership of installed files or directories to group. The default is the process's current group. group may be either a group name or a numeric group ID.
-m mode
--mode=mode
Set the file mode bits for the installed file or directory to mode, which can be either an octal number, or a symbolic mode as in chmod, with ‘a=’ (no access allowed to anyone) as the point of departure (see File permissions). The default mode is ‘u=rwx,go=rx,a-s’—read, write, and execute for the owner, read and execute for group and other, and with set-user-ID and set-group-ID disabled. This default is not quite the same as ‘755’, since it disables instead of preserving set-user-ID and set-group-ID on directories. See Directory Setuid and Setgid.
-o owner
--owner=owner
If install has appropriate privileges (is run as root), set the ownership of installed files or directories to owner. The default is root. owner may be either a user name or a numeric user ID.
-p
--preserve-timestamps
Set the time of last access and the time of last modification of each installed file to match those of each corresponding original file. When a file is installed without this option, its last access and last modification times are both set to the time of installation. This option is useful if you want to use the last modification times of installed files to keep track of when they were last built as opposed to when they were last installed.
-s
--strip
Strip the symbol tables from installed binary executables.
-S suffix
--suffix=suffix
Append suffix to each backup file made with -b. See Backup options.
-t directory
--target-directory=directory
Specify the destination directory. See Target directory.
-T
--no-target-directory
Do not treat the last operand specially when it is a directory or a symbolic link to a directory. See Target directory.
-v
--verbose
Print the name of each file before copying it.

An exit status of zero indicates success, and a nonzero value indicates failure.