LinuxCommandLibrary

install

TLDR

Copy file with permissions

$ install -m [755] [source] [dest]
copy
Copy to directory
$ install [file] [/usr/local/bin/]
copy
Create directory
$ 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
$ install -s [binary] [/usr/local/bin/]
copy

SYNOPSIS

install [options] source dest
install [options] -d directories

DESCRIPTION

install copies files while setting permissions and ownership. It's 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 backup existing files.

PARAMETERS

-m mode

Set permission mode.
-o owner
Set owner.
-g group
Set group.
-d
Create directories.
-D
Create parent directories.
-s
Strip symbol tables.
-p
Preserve timestamps.
-b
Make backup of existing dest.
-S suffix
Backup suffix.
-v
Verbose output.
-c
Ignored (compatibility).

CAVEATS

Not for general file copying. Strips binaries by default on some systems. 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