install(1) — Commands
OSF
NAME
install − Installs a command
SYNOPSIS
install [-sS] [-c directory] [-g group] [-m mode] [-u owner] file [directory ...]
install [-osS] [-f directory] [-g group] [-m mode] [-u owner] file [directory ...]
install [-g group] [-iosS] [-m mode] [-n directory] [-u owner] file [directory ...]
install [-g group] [-MosS] [-m mode] [-u owner] file [directory ...]
The install command installs file in a specific place within a file system. It is most often used in makefiles.
FLAGS
-c directory
Installs a new command file in directory only if that file does not already exist there. If install 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 -g, -m, -s, -S, or -u flags.
-f directory
Forces installation of file in directory 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 -g, -m, -o, -s, -S, or -u flags.
-g groupSpecifies a different group for the destination file. The default group is bin.
-iIgnores 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.
-MMoves file to the directory instead of copying it. Cannot be used with the -c, -f, -i, or -n flags.
-m modeSpecifies the mode of the destination file.
-n directory
Installs file in directory 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 flags.
-oSaves the old copy of file by copying it into a file called OLDfile in the same directory. This flag cannot be used with the -c flag.
-u owner
Specifies a different owner of the destination file. The default owner is bin.
-sSuppresses the display of all but error messages.
-SCauses the binary to be stripped after installation (see strip).
DESCRIPTION
When replacing files, the install command copies (or moves) each file into the appropriate directory, thereby retaining the original owner and permissions. A newly created file has permission code 755, owner bin, and group bin. The install command writes a message telling you which files it is replacing or creating and where they are going.
If you supply no arguments, the install command searches the /bin, /usr/bin, /etc, /lib, and /usr/lib directories (in that order) for a file with the same name as file. 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 without taking further action.
If any directories are specified on the command line, the install command searches them before it searches the default directories.
EXAMPLES
1.To replace a command that already exists in one of the default directories, enter:
install fixit
This replaces the file fixit if it is found in the /bin, /usr/bin, /etc, /lib, or /usr/lib directory. Otherwise, the file fixit 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.
2.To replace a command that already exists in a specified or default directory, and to preserve the old version, enter:
install -o fixit /etc /usr/games
This replaces the file fixit if it is found in the /etc or /usr/games directory, or in one of the default directories. Otherwise, the file fixit 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.
3.To replace a command that already exists in a specified directory, enter:
install -i fixit /u/judith/bin /u/bernice/bin /usr/games
This replaces the file fixit if it is found in the /u/judith/bin, /u/bernice/bin, or /usr/games directory. Otherwise, the file is not installed.
4.To replace a command found in a default directory, or install it in a specified directory if it is not found, enter:
install -n /usr/bin fixit
This replaces the file fixit if it is found in one of the default directories. If the file is not found, it is installed as /usr/bin/fixit.
5.To install a new command, enter:
install -c /usr/bin fixit
This 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.
6.To install a command in a specified directory whether or not it already exists, enter:
install -f /usr/bin -o -s fixit
This 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 was installed are suppressed (a result of the -s flag).
RELATED INFORMATION
Commands: chgrp(1), chmod(1), chown(1), cp(1), installbsd(1), make(1), mv(1), strip(1).