install is a versatile file-copying command in Linux and macOS. It’s perfect for the power-user looking for efficiency. Read this article to discover how to work smarter—not harder.
Wait—It’s Not For Installing Software?
install command might have the most misleading name of any of the Linux commands. It doesn’t actually install any software. If you’re trying to install a software package from the command line in Ubuntu or another Debian-based distribution use the
apt-get command. On other Linux distributions, use your Linux distribution’s package management tool instead—for example,
dnf on Fedora or
zypper on openSUSE.
So What Does install Do?
In a nutshell
install combines elements from the
chown (change owner),
chmod (change mode),
mkdir (make directory), and
strip (strip symbols) commands. It lets you use functions from all of those in one single action.
install command can:
- Copy files like the
- Choose whether to overwrite existing files.
- Create the target directory if it does not exist, like
- Set the user permission flags of the files, just like the
- Set the owner of the files, just like the
- Remove non-essential baggage from executable files, just like the
Despite all that functionality, the
install command doesn’t have too many options to contend with.
When Would You Use It
install command probably won’t be used every day. It’s useful, but only for certain situations. One scenario where
install comes into its own is software development. Let’s say you’re programming a new utility. You’ll need to do testing outside of the development environment. To do that you need to copy the new program files to a test directory. The test directory might need to be created, and you need to set the correct permissions and ownership for the files.
Because development is an iterative activity, you can end up doing this sequence of actions many, many times. The
install command does all the heavy lifting for you. Finally, when your new utility is ready to be deployed, you can use
install to copy it with the correct permissions to its final working location.