coreutils: install invocation
1
1 11.3 ‘install’: Copy files and set attributes
1 =============================================
1
1 ‘install’ copies files while setting their file mode bits and, if
1 possible, their owner and group. Synopses:
1
1 install [OPTION]... [-T] SOURCE DEST
1 install [OPTION]... SOURCE... DIRECTORY
1 install [OPTION]... -t DIRECTORY SOURCE...
1 install [OPTION]... -d DIRECTORY...
1
1 • If two file names are given, ‘install’ copies the first file to the
1 second.
1
1 • If the ‘--target-directory’ (‘-t’) option is given, or failing that
1 if the last file is a directory and the ‘--no-target-directory’
1 (‘-T’) option is not given, ‘install’ copies each SOURCE file to
1 the specified directory, using the SOURCEs’ names.
1
1 • If the ‘--directory’ (‘-d’) option is given, ‘install’ creates each
1 DIRECTORY and any missing parent directories. Parent directories
1 are created with mode ‘u=rwx,go=rx’ (755), regardless of the ‘-m’
1 option or the current umask. ⇒Directory Setuid and Setgid,
1 for how the set-user-ID and set-group-ID bits of parent directories
1 are inherited.
1
1 ‘install’ is similar to ‘cp’, but allows you to control the
1 attributes of destination files. It is typically used in Makefiles to
1 copy programs into their destination directories. It refuses to copy
1 files onto themselves.
1
1 ‘install’ never preserves extended attributes (xattr).
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-b’
1 ‘--backup[=METHOD]’
1 ⇒Backup options. Make a backup of each file that would
1 otherwise be overwritten or removed.
1
1 ‘-C’
1 ‘--compare’
1 Compare each pair of source and destination files, and if the
1 destination has identical content and any specified owner, group,
1 permissions, and possibly SELinux context, then do not modify the
1 destination at all. Note this option is best used in conjunction
1 with ‘--user’, ‘--group’ and ‘--mode’ options, lest ‘install’
1 incorrectly determines the default attributes that installed files
1 would have (as it doesn’t consider setgid directories and POSIX
1 default ACLs for example). This could result in redundant copies
1 or attributes that are not reset to the correct defaults.
1
1 ‘-c’
1 Ignored; for compatibility with old Unix versions of ‘install’.
1
1 ‘-D’
1 Create any missing parent directories of DEST, then copy SOURCE to
1 DEST. Explicitly specifying the ‘--target-directory=DIR’ will
1 similarly ensure the presence of that hierarchy before copying
1 SOURCE arguments.
1
1 ‘-d’
1 ‘--directory’
1 Create any missing parent directories, giving them the default
1 attributes. Then create each given directory, setting their owner,
1 group and mode as given on the command line or to the defaults.
1
1 ‘-g GROUP’
1 ‘--group=GROUP’
1 Set the group ownership of installed files or directories to GROUP.
1 The default is the process’s current group. GROUP may be either a
1 group name or a numeric group ID.
1
1 ‘-m MODE’
1 ‘--mode=MODE’
1 Set the file mode bits for the installed file or directory to MODE,
1 which can be either an octal number, or a symbolic mode as in
1 ‘chmod’, with ‘a=’ (no access allowed to anyone) as the point of
1 departure (⇒File permissions). The default mode is
1 ‘u=rwx,go=rx,a-s’—read, write, and execute for the owner, read and
1 execute for group and other, and with set-user-ID and set-group-ID
1 disabled. This default is not quite the same as ‘755’, since it
1 disables instead of preserving set-user-ID and set-group-ID on
1 directories. ⇒Directory Setuid and Setgid.
1
1 ‘-o OWNER’
1 ‘--owner=OWNER’
1 If ‘install’ has appropriate privileges (is run as root), set the
1 ownership of installed files or directories to OWNER. The default
1 is ‘root’. OWNER may be either a user name or a numeric user ID.
1
1 ‘--preserve-context’
1 Preserve the SELinux security context of files and directories.
1 Failure to preserve the context in all of the files or directories
1 will result in an exit status of 1. If SELinux is disabled then
1 print a warning and ignore the option.
1
1 ‘-p’
1 ‘--preserve-timestamps’
1 Set the time of last access and the time of last modification of
1 each installed file to match those of each corresponding original
1 file. When a file is installed without this option, its last
1 access and last modification timestamps are both set to the time of
1 installation. This option is useful if you want to use the last
1 modification timestamps of installed files to keep track of when
1 they were last built as opposed to when they were last installed.
1
1 ‘-s’
1 ‘--strip’
1 Strip the symbol tables from installed binary executables.
1
1 ‘--strip-program=PROGRAM’
1 Program used to strip binaries.
1
1 ‘-S SUFFIX’
1 ‘--suffix=SUFFIX’
11 Append SUFFIX to each backup file made with ‘-b’. ⇒Backup
options.
1
1 ‘-t DIRECTORY’
1 ‘--target-directory=DIRECTORY’
1 Specify the destination DIRECTORY. ⇒Target directory. Also
1 specifying the ‘-D’ option will ensure the directory is present.
1
1 ‘-T’
1 ‘--no-target-directory’
1 Do not treat the last operand specially when it is a directory or a
1 symbolic link to a directory. ⇒Target directory.
1
1 ‘-v’
1 ‘--verbose’
1 Print the name of each file before copying it.
1
1 ‘-Z’
1 ‘--context[=CONTEXT]’
1 Without a specified CONTEXT, adjust the SELinux security context
1 according to the system default type for destination files,
1 similarly to the ‘restorecon’ command. The long form of this
1 option with a specific context specified, will set the context for
1 newly created files only. With a specified context, if both
1 SELinux and SMACK are disabled, a warning is issued. This option
1 is mutually exclusive with the ‘--preserve-context’ option.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1