/usr/bin/install [ -c DirectoryA ] [ -f DirectoryB ] [ -i ] [ -m ] [ -M Mode ] [ -O Owner ] [ -G Group ] [ -S ] [ -n DirectoryC ] [ -o ] [ -s ] File [ Directory ... ]
The install command installs a specified file in a specific place within a file system. It is most often used in makefiles. When replacing files, the install command copies (or moves) each file into the appropriate directory, thereby retaining the original owner and permissions based on the behavior of the cp and mv commands. An attempt is made to change the destination to owner bin and group bin. The -O Owner and -G Group flags can be used to specify a different owner or group. The install command writes a message telling you exactly which files it is replacing or creating and where they are going.
If you do not specify the Directory parameter, the install command searches a set of default directories (/usr/bin, /etc, and /usr/lib, in that order) for a file with the same name as the File parameter. The first time it finds one, it overwrites it with File and issues a message indicating that it has done so. If a match is not found, the install command issues a message telling you there was no match and exits with no further action. If the File parameter does not exist in the current directory, the install command displays an error message and exits with a nonzero value.
If any directories are specified on the command line, the install command searches them before it searches the default directories.
install fixitThis replaces the fixit file if it is found in the /usr/bin, /etc, or /usr/lib directory. Otherwise, the fixit file is not installed. For example, if /usr/bin/fixit exists, then this file is replaced by a copy of the file fixit in the current directory.
install -o fixit /etc /usr/gamesThis replaces the fixit file if it is found in the /etc or /usr/games directory or in one of the default directories. Otherwise the fixit file is not installed. If the file is replaced, the old version is preserved by renaming it OLDfixit in the directory in which it was found.
install -i fixit /home/jim/bin /home/joan/bin /usr/gamesThis replaces the fixit file if it is found in the /home/jim/bin, /home/joan/bin, or /usr/games directory. Otherwise, the file is not installed.
install -n /usr/bin fixitThis replaces the fixit file if it is found in one of the default directories. If the file is not found, it is installed as /usr/bin/fixit.
install -c /usr/bin fixitThis creates a new command by installing a copy of the fixit file as /usr/bin/fixit, but only if this file does not already exist.
install -f /usr/bin -o -s fixitThis forces the fixit file to be installed as /usr/bin/fixit whether or not it already exists. The old version, if any, is preserved by moving it to /usr/bin/OLDfixit (a result of the -o flag). The messages that tell where the new command is installed are suppressed (a result of the -s flag).
For compatibility with Berkeley Software Distribution (BSD), two install commands exist. See the installbsd command.
/usr/bin/install | Contains the install command. |
The chgrp command, chmod command, chown command, cp command, installbsd command, make command, mv command, strip command.