LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

install

copies files while setting permissions and ownership

TLDR

Copy file with specific permissions
$ install -m [755] [source] [dest]
copy
Copy files into a target directory
$ install -t [/usr/local/bin/] [file1] [file2]
copy
Create directories (including parents)
$ install -d [/path/to/dir]
copy
Set owner and group
$ install -o [user] -g [group] [file] [dest]
copy
Copy preserving timestamps
$ install -p [file] [dest]
copy
Strip binaries during install
$ install -s [binary] [/usr/local/bin/]
copy
Copy only if source is different (avoids unnecessary writes)
$ install -C [file] [dest]
copy
Create parent directories then copy
$ install -D [source] [/path/to/new/dir/dest]
copy

SYNOPSIS

install [options] [-s] [--strip-program=PROGRAM] source... destinstall [options] -t DIRECTORY source...install [options] -d directories...

DESCRIPTION

install copies files while setting permissions and ownership. It is primarily used in Makefiles and installation scripts to place files with correct attributes.The tool combines cp, chmod, chown, and mkdir functionality, streamlining installation tasks. It can also strip binaries and back up existing files. The default permission mode is rwxr-xr-x (755).

PARAMETERS

-m mode, --mode=mode

Set permission mode (as in chmod), instead of the default rwxr-xr-x.
-o owner, --owner=owner
Set ownership (super-user only).
-g group, --group=group
Set group ownership instead of the process's current group.
-d, --directory
Treat all arguments as directory names; create all components of the specified directories.
-D
Create all leading parent directory components of dest, then copy source to dest.
-t DIRECTORY, --target-directory=DIRECTORY
Copy all source arguments into DIRECTORY.
-T, --no-target-directory
Treat dest as a normal file, not a directory.
-C, --compare
Compare source and destination; do not modify dest if content, ownership, and permissions are unchanged.
-s, --strip
Strip symbol tables from installed binaries.
--strip-program=PROGRAM
Program used to strip binaries (default: strip).
-p, --preserve-timestamps
Apply access/modification times of source files to destination files.
-b
Make a backup of each existing destination file.
--backup[=CONTROL]
Make a backup of each existing destination file, with optional version control method.
-S suffix, --suffix=suffix
Override the usual backup suffix.
-v, --verbose
Print the name of each file or directory as it is created.
-c
Ignored; for compatibility with older Unix versions.
-Z, --context
Set SELinux security context of destination files to the default type.

CAVEATS

Not intended for general file copying. The default permission mode is 755 (rwxr-xr-x), unlike cp which preserves source permissions. Requires appropriate privileges for ownership changes.

HISTORY

install is a traditional Unix utility, part of GNU coreutils on Linux. It has been used in Makefiles since early Unix for standardized software installation procedures.

SEE ALSO

cp(1), chmod(1), chown(1), mkdir(1), make(1)

Copied to clipboard
Kai