This tutorial explains Linux “install” command, options and its usage with examples.
`install’ is similar to `cp’, but allows you to control the attributes of destination files. It is typically used in Makefiles to copy programs into their destination directories. It refuses to copy files onto themselves.
This install program copies files (often just compiled) into destination locations you choose. If you want to download and install a ready-to-use package on a GNU/Linux system, you should instead be using a package manager like yum(1) or apt-get(1).
install [OPTION]… [-T] SOURCE DEST
install [OPTION]… SOURCE… DIRECTORY
install [OPTION]… -t DIRECTORY SOURCE…
install [OPTION]… -d DIRECTORY…
* If two file names are given, `install’ copies the first file to the second.
* If the `–target-directory’ (`-t’) option is given, or failing that if the last file is a directory and the `–no-target-directory’ (`-T’) option is not given, `install’ copies each SOURCE file to the specified directory, using the SOURCEs’ names.
* If the `–directory’ (`-d’) option is given, `install’ creates each DIRECTORY and any missing parent directories. Parent directories are created with mode `u=rwx,go=rx’ (755), regardless of the `-m’ option or the current umask.
Compare each pair of source and destination files, and if the destination has identical content and any specified owner, group,permissions,then do not modify the destination at all.
Create any missing parent directories of DEST, then copy SOURCE to DEST. This option is ignored if a destination Directory is specified via `–target-directory=DIR’.
Create any missing parent directories, giving them the default attributes. Then create each given directory, setting their owner, group and mode as given on the command line or to the defaults.
Set the file mode bits for the installed file or directory to MODE,which can be either an octal number, or a symbolic mode as in `chmod’. The default mode is `u=rwx,go=rx,a-s’–read, write, and execute for the owner, read and execute for group and other.
If `install’ has appropriate privileges (is run as root), set the ownership of installed files or directories to OWNER. The default is `root’. OWNER may be either a user name or a numeric user ID.
Set the time of last access and the time of last modification of each installed file to match those of each corresponding original file. When a file is installed without this option, its last access and last modification times are both set to the time of installation.
Specify the destination DIRECTORY.
set group ownership, instead of process’ current group
Say u need to install all .py files in a destination directory. So the following process can be followed :
$ install -d /dest/path
This creates the directory hierarchy prior to installing. AND THEN
$ install -D /source/path/*.py /dest/path
This installs all the files in the corresponding directories created.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.
- Apply for Linux Internship
- Buy Information Technology Books
- Practice Programming MCQs
- Buy Linux Books
- Apply for Programming Internship