install - Linux


The install command in Linux is used for copying files and setting attributes. It is often utilized in Makefiles during the installation of software to ensure that proper file permissions and ownerships are set. The command provides more control compared to simply using cp, as it is designed to set up executable files and directories with specific attributes in place.


The general syntax of the install command is:

install [OPTION]... -t DIRECTORY SOURCE...
install [OPTION]... -d DIRECTORY...
  • SOURCE: Specifies the source file(s) to copy.
  • DEST: Specifies the destination file or directory.
  • DIRECTORY: Target directory for installing the files.


  • -m, --mode=MODE: Set permission mode (as in chmod), instead of the default 755 (rwxr-xr-x).
  • -o, --owner=OWNER: Set the owner of the installed file. The OWNER can be a user name or numeric user ID.
  • -g, --group=GROUP: Set the group of the installed file. The GROUP can be a group name or numeric group ID.
  • -t, --target-directory=DIRECTORY: Specify the directory to install the files.
  • -d, --directory: Treat all arguments as directory names and create each of them.
  • -c: Ignored; for compatibility with old Unix versions of install.
  • -D: Create all leading components of DEST except the last, then copy SOURCE to DEST.
  • -s, --strip: Strip symbol tables. Useful for reducing the executable file size by removing debugging information.
  • -p, --preserve-timestamps: Preserve the time of the original files in the new files.
  • -v, --verbose: Display verbose output.


  1. Simple Installation of a File:

    install -m 755 /usr/local/bin/script

    This installs to /usr/local/bin/script with execution permissions.

  2. Installing Multiple Files Into a Directory:

    install -m 644 file1.txt file2.txt /usr/local/share/docs

    Installs file1.txt and file2.txt into /usr/local/share/docs with read/write permissions for user, and read-only for others.

  3. Creating Directories:

    install -d /usr/local/share/myapp

    Creates the directory /usr/local/share/myapp.

Common Issues

  • Permission Denied: Make sure you have the necessary permissions to install files in the destination directory.
  • File Overwrite Concerns: install will overwrite files without warning. Use caution when specifying targets.


Combine install with shell scripts for robust installation routines. For instance, use a loop to install multiple files:

for file in $(ls *.sh); do
    install -m 755 "$file" /usr/local/bin/"$file"
  • cp: Copies files and directories.
  • chmod: Changes file modes or Access Control Lists.
  • chown: Changes file owner and group.

For more advanced details, refer to the install man page by typing man install in your terminal. This provides a comprehensive guide to its usage and options.