install
PURPOSE
Installs a command.
SYNOPSIS
install [-n dir][-l -o -s]... file [dir...]
install -c dir [-s] file
install -f dir [-o][-s] file
DESCRIPTION
The install command installs file in a specific place
within a file system. It is most often used in
"makefiles" (see "make"). When replacing files, install
copies 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. install writes a message telling you exactly
which files it is replacing or creating and where they
are going.
If you do not supply any arguments, install searches a
set of default directories (/bin, /usr/bin, /etc, /lib,
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 indicating that it has
done so. If a match is not found, install issues a
message telling you there was no match and exits with no
further action.
If any directories are specified on the command line,
install searches them before it searches the default
directories.
FLAGS
-c directory Installs a new command file in directory
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 -s.
-f directory Forces installation of file in directory
whether or not file already exists. If
the file being installed does not already
exist, install sets the permission code
and owner of the new file to 755 and bin,
respectively. This flag can be used alone
or with -o or -s.
-i Ignores the default directory list and
searches only those directories specified
on the command line. This flag cannot be
used with -c or -f.
-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 -c or -f.
-o Saves the old copy of file by copying it
to OLDfile in the directory in which it
found it. This flag cannot be used with
-c.
-s Suppresses display of all but error mes-
sages.
EXAMPLES
1. To replace a command that already exists in one of
the default directories:
install fixit
This replaces "fixit" if it is found in /bin,
/usr/bin, /etc, /lib, or /usr/lib. Otherwise, it 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 speci-
fied or default directory, and to preserve the old
version:
install -o fixit /etc /usr/games
This replaces "fixit" if found in /etc, /usr/games,
or one of the default directories. Otherwise it is
not installed. If "fixit" is replaced, the old
version is preserved by renaming it OLD"fixit" in the
directory in which it was found (-o).
3. To replace a command that already exists in a speci-
fied directory:
install -i fixit /u/jim/bin /u/joan/bin /usr/games
This replaces "fixit" if found in "/u/jim/bin",
"/u/joan/bin", or /usr/games. Otherwise it is not
installed.
4. To replace a command if found in a default directory,
or install it in a specified directory if not found:
install -n /usr/bin fixit
This replaces "fixit" if found in one of the default
directories. If "fixit" is not found, it is
installed as "/usr/bin/fixit" (-n /usr/bin).
5. To install a new command:
install -c /usr/bin fixit
This creates a new command by installing a copy of
"fixit" 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:
install -f /usr/bin -o -s fixit
This forces "fixit" 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/"OLD"fixit" (-o). The messages that tell
where the new command was installed are suppressed
(-s).
RELATED INFORMATION
The following command: "make."
The mk system maintenance procedure in AIX Operating
System Technical Reference.