Installs a command.
/usr/bin/install [-c DirectoryA] [-f DirectoryB] [-i] [-m] [-M Mode] [-O Owner] [-GGroup] [-S] [-nDirectoryC] [-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.
|-c DirectoryA||Installs a new command file in the DirectoryA variable only if that file does not already exist there. If it finds a copy of File there, it issues a message and exits without overwriting the file. This flag can be used alone or with the -s, -M, -O, -G, or -S flag.|
|-f DirectoryB||Forces installation of File in DirectoryB whether or not File already exists. If the file being installed does not already exist, the command sets the permission code and owner of the new file to 755 and bin, respectively. This flag can be used alone or with the -o,-s, -M, -O, -G, or -S flags.|
|-G Group||Specifies a different group for the destination file. The default group is bin.|
|-i||Ignores the default directory list and searches only those directories specified on the command line. This flag cannot be used with the -c, -f, or -m flags.|
|-m||Moves the File parameter to the directory instead of being copied. Cannot be used with the -c, -f, -i, or -n flag.|
|-M Mode||Specifies the mode of the destination file.|
|-n DirectoryC||Installs the File parameter in the DirectoryC variable if it is not in any of the searched directories, and sets the permissions and owner of the file to 755 and bin, respectively. This flag cannot be used with the -c, -f, or -m flag.|
|-o||Saves the old copy of the File parameter by copying it into a file called OLDFile in the same directory. This flag cannot be used with the -c flag.|
|-O Owner||Specifies a different owner of the destination file. The default owner is bin.|
|-s||Suppresses the display of all but error messages.|
|-S||Causes the binary to be stripped after installation.|
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.