install
Copy files and set attributes
TLDR
Copy files to the destination
Copy files to the destination, setting their ownership
Copy files to the destination, setting their group ownership
Copy files to the destination, setting their mode
Copy files and apply access/modification times of source to the destination
Copy files and create the directories at the destination if they don't exist
SYNOPSIS
install [OPTION]... SOURCE DEST
install [OPTION]... SOURCE... DIRECTORY
install [OPTION]... -t DIRECTORY SOURCE...
PARAMETERS
-b, --backup[=METHOD]
back up existing destination files (METHOD: none, number, existing, numbered)
-c
ignored (deprecated)
-d, --directory
treat args as directories; create all components
-D
create all leading components of DEST except last, then copy SOURCE to DEST
-g, --group=GROUP
set group (numeric or name)
-m, --mode=MODE
set permission mode (octal like 0755)
-o, --owner=OWNER
set owner (numeric or name)
-p, --preserve-timestamps
preserve modification times
-s, --strip
strip symbols with 'strip' command
-S, --suffix=SUFFIX
custom backup suffix
-t, --target-directory=DIRECTORY
copy all SOURCEs into DIRECTORY
-T, --no-target-directory
treat DEST as normal file
-v, --verbose
print actions
--context=CTX
set SELinux security context
--preserve-context
preserve SELinux context
--help
display usage
--version
output version info
DESCRIPTION
The install command is a powerful utility for copying files and directories to their destination locations, particularly during software installation from build systems like Makefiles. It extends basic copying (cp) by automatically setting file ownership, group, mode (permissions), and timestamps, while optionally stripping debugging symbols from binaries. install supports installing single files, multiple files into a directory, or creating directories with -d. It creates parent directories if needed with -D and can backup existing files to avoid data loss.
Ideal for deployment scripts, it ensures installed files have production-ready attributes without extra chmod, chown, or strip commands. Verbose mode aids debugging, and options like --preserve-timestamps maintain build times. On systems with SELinux, context handling is supported. While safe for most uses, it overwrites destinations by default (unless backed up), making it unsuitable as a general copier. Part of GNU coreutils, it's POSIX-compliant with GNU extensions for advanced features.
CAVEATS
Overwrites destinations by default unless --backup used; requires privileges for ownership changes; -c deprecated and ignored; not for package management.
COMMON EXAMPLE
install -m 755 -o root -g root foo /usr/local/bin/
Copies 'foo' to /usr/local/bin/foo as executable owned by root.
EXIT STATUS
0: success
1: general error (permissions, missing files)
2: misuse of options
HISTORY
Originated in AT&T Version 7 Unix (1979); GNU version in coreutils package since early 1990s, with ongoing enhancements for security contexts and atomic installs.


