Linux 'Install' Command

Copy files in Linux with the 'install' command

The install command on Linux systems copies files by combining several commands into one. The install command uses the cp, chown, chmod, and strip commands. The install command should not be used to install applications that are prepared for use, though. Those should be downloaded and installed using the Linux distribution's package management system.

Close up of woman's hands using laptop at home
Andreas Larsson / Getty Images

Install Command Syntax

The proper syntax for the install command includes options, a source file, and a destination file.

install [OPTION]... -d DIRECTORY

These are the options that govern the install command:

  • --backup[=CONTROL] makes a backup of each existing destination file.
  • -b is like --backup but does not accept an argument.
  • -c is (ignored).
  • -d, --directory will treat all arguments as directory names; create all components of the specified directories.
  • -D creates all leading components of DEST except the last, then copies SOURCE to DEST. It's useful in the first format above.
  • -g, --group=GROUP sets group ownership.
  • -m, --mode=MODE sets permission mode (as in chmod), instead of rwxr-xr-x.
  • -o, --owner=OWNER sets ownership (super-user only).
  • -p, --preserve-timestamps applies access/modification times of source files to corresponding destination files.
  • -s, --strip strips symbol tables. It's useful only for the first and second formats above.
  • -S, --suffix=SUFFIX overrides the usual backup suffix.
  • -v, --verbose prints the name of each directory as it's created.
  • -z, --context-CONTEXT sets SELinux security context of files and directories.
  • --help displays help information and exits.
  • --version outputs version information and exits.

The backup suffix is ~ unless set with --suffix or SIMPLE_BACKUP_SUFFIX environment variable. The version control method may be selected using the --backup option or through the VERSION_CONTROL environment variable.

These are the values:

  • none, off never make backups (even if --backup is given).
  • numbered, t makes numbered backups.
  • existing, nil is numbered if numbered backups exist: otherwise; it's simple.
  • simple, never always make simple backups.

The full documentation for the install command is maintained as a Texinfo manual. If the info and install programs are properly installed at your site, the command info install should access the complete manual.

Use the man command (man) to see how a command is used on your computer.

Example of the Install Command

The following command offers an example of how to use the install Linux command to copy files. Each folder and file should be customized for your situation.

$install -D /source/folder/*.py /destination/folder

Here, the -D option is used to copy the .py files from the /source/folder to the /destination/folder folder. Again, everything but install and -D should be altered to fit your files and folders.

If you need to make the destination folder, use this command, for example:

$install -d /destination/folder
Was this page helpful?