install Command Purpose Installs a command. Syntax /usr/bin/install [ - c DirectoryA ] [ - f DirectoryB ] [ - i ] [ - m ] [ - M Mode ] [ - O Owner ] [ - G Group ] [ - S ] [ - n DirectoryC ] [ - o ] [ - s ] File [ Directory ... ] Description 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 com- mands. A newly created File has permis- sion code 755, owner bin, and group bin. 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 a Directory, 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 File. The first time it finds one, it overwrites it with File and issues a message indi- cating 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 any directories are specified on the command line, the install command searches them before it searches the default directories. Flags -c DirectoryA Installs a new command file in DirectoryA 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 flags. -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 The File is moved to the directory instead of being copied. Cannot be used with the -c, -f, -i, or -n flags. -M Mode Specifies the mode of the destination file. -n DirectoryC Installs File in DirectoryC 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. -o Saves 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. -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. Examples 1. To replace a command that already exists in one of the default directories, enter: install fixit This 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. 2. To replace a command that already exists in a specified or de- fault directory, and to preserve the old version, enter: install -o fixit /etc /usr/games This replaces the fixit file if it is found in the /etc or /usr/games directory, or in one of the default directories. Oth- erwise 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. 3. To replace a command that already exists in a specified direc- tory, enter: install -i fixit /home/jim/bin /home/joan/bin /usr/games This 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. 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 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. 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 is installed are suppressed (a result of the -s flag). Compatibility For compatibility with Berkeley Software Distribution (BSD), there are two install commands. See the install (BSD) command. Implementation Specifics This command is part of Base Operating System (BOS) Runtime. Files /usr/bin/install The install command. Related Information The chgrp command, chmod command, chown command, cp command, install (BSD) command, make command, mv command, strip com- mand. install Command (BSD) Purpose Installs a command (BSD version of the install command). Syntax /usr/ucb/install [ - c ] [ - m Mode ] [ - o Owner ] [ - g Group ] [- s ] BinaryFile Destination Description The install command, Berkeley Software Distribution (BSD) ver- sion, moves (by default) or copies the BinaryFile file to the Destination file or directory. If a Destination file already ex- ists, it is removed before the BinaryFile file is moved. If the destination is a directory, the BinaryFile file is moved into the directory with its original file name. The install program does not move a file onto itself. Flags -c Copies BinaryFile to the Destination file or directory. If a Destination file already exists, it is removed before BinaryFile is copied. If the destination is a directory, BinaryFile is copied into the directory with its original file name. -m Mode Specifies a mode for the Destination file other than the default 755. -o Owner Specifies an owner for the Destination file other than the default owner, which is root. -g Group Specifies a group for the Destination file other than the default group staff. -s Specifies that BinaryFile is stripped after being installed. Examples To install a new command called fixit, enter: /usr/ucb/install -c fixit /usr/bin This creates a new command by installing a copy of the fixit com- mand as the /usr/bin/fixit command. Compatibility For compatibility with BSD, there are two install commands. For the other version, see the install command. Implementation Specifics This command is part of Base Operating System (BOS) Runtime. Files /usr/ucb/install The install command (BSD). Related Information The chgrp command, chmod command, chown command, cp command, install command, mv command, strip command.