- What is linux install command
- ОПИСАНИЕ
- ОПЦИИ
- ОПЦИИ РЕЗЕРВНОГО КОПИРОВАНИЯ GNU
- install command in Linux with examples
- Linux ‘Install’ Command
- Copy files in Linux with the ‘install’ command
- Install Command Syntax
- Example of the Install Command
- install(1) — Linux man page
- Synopsis
- Description
- Author
- Reporting Bugs
- Copyright
- See Also
- What is the purpose of the ‘install’ command?
- 4 Answers 4
What is linux install command
Опции (краткая форма):
[-b] [-c] [-D] [-g группа ] [-m режим ] [-o владелец ] [-S СУФФИКС ] [-V
ОПИСАНИЕ
В первой из вышеуказанных форм вызова, исходный_файл копируется в файл_назначения . Во второй форме каждый из исходных_файлов копируется в заданный каталог . В последней форме вызова, создается каждый каталог (и любые недостающие родительские каталоги).
Программа install похожа на cp , но позволяет вам управлять атрибутами копируемых файлов. Обычно install используется в файлах Makefile для копирования программ в необходимые каталоги. Копирование файлов самих в себя отвергается.
ОПЦИИ
ОПЦИИ РЕЗЕРВНОГО КОПИРОВАНИЯ GNU
Если данная опция не задана, то суффикс можно также задать, используя переменную окружения SIMPLE_BACKUP_SUFFIX Если не задана ни опция, ни переменная, то по умолчанию используется суффикс
. -V МЕТОД , —version-control= МЕТОД Определяет, как будут называться резервные копии файлов. Аргумент МЕТОД может принимать значения numbered (или t), existing (или nil) и never (или simple). Если данная опция не задана, то будет использовано значение переменной окружения VERSION_CONTROL . Если же не задано значение и этой переменной, то по умолчанию тип резервного копирования устанавливается в existing.
Данная опция соответствует переменной version-control в Emacs. Допустимыми значениями МЕТОД являются (допускаются однозначные сокращения): t , numbered Всегда делать нумерованные резервные копии файлов. nil , existing Делать нумерованные резервные копии файлов для файлов, которые уже их имеют и простые резервные копии для остальных файлов. never , simple Всегда делать простые резервные копии.
Источник
install command in Linux with examples
install command is used to copy files and set attributes. It is used to copy files to a destination of the user’s choice, If the user want to download and install a ready to use package on GNU/Linux system then he should use apt-get, apt, yum, etc depending on their distribution.
Syntax:
Here, the first three forms are used to copy the SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY while setting permission modes and owner/group. But the fourth form is used to create all components of the given DIRECTORY.
Options:
- –backup[=CONTROL] : This option is used to create a backup of each existing destination file.
- -b : Like –backup but It will not accept an argument.
- -C, –compare : Used to compare each pair of source and destination files. But in some cases it does not modify the destination.
- -d, –directory : It will act as directory names towards all arguments. And create all components of the specified directories.
- -g, –group=GROUP : Used to set group ownership, instead of processing the current group.
- -m, –mode=MODE : Set permission mode (as in chmod).
- -o, –owner=OWNER : Set ownership (super-user only).
- -p, –preserve-timestamps : Apply access/modification times of SOURCE files to corresponding destination files
- -t, –target-directory=DIRECTORY : Copy all SOURCE arguments into DIRECTORY.
- -T, –no-target-directory : Treat DEST as a normal file.
- -v, –verbose : Used to show the name of each directory as it is created.
- –help : Display the help message and exit.
- –version : Shows the version information and exit.
Examples:
- Copies two files rocket.c and rocket to directory demo.
Compare and copies files(observe the difference).
Using -T option(observe that it makes a file instead of directory).
Changing owner and permissions.
Printing version information.
Источник
Linux ‘Install’ Command
Copy files in Linux with the ‘install’ command
The install command on Linux systems copies files by combining several commands into one. The install command uses the cp, chown, chmod, and strip commands. The install command should not be used to install applications that are prepared for use, though. Those should be downloaded and installed using the Linux distribution’s package management system.
Install Command Syntax
The proper syntax for the install command includes options, a source file, and a destination file.
These are the options that govern the install command:
- —backup[=CONTROL] makes a backup of each existing destination file.
- -b is like —backup but does not accept an argument.
- -c is (ignored).
- -d, —directory will treat all arguments as directory names; create all components of the specified directories.
- -D creates all leading components of DEST except the last, then copies SOURCE to DEST. It’s useful in the first format above.
- -g, —group=GROUP sets group ownership.
- -m, —mode=MODE sets permission mode (as in chmod), instead of rwxr-xr-x.
- -o, —owner=OWNER sets ownership (super-user only).
- -p, —preserve-timestamps applies access/modification times of source files to corresponding destination files.
- -s, —strip strips symbol tables. It’s useful only for the first and second formats above.
- -S, —suffix=SUFFIX overrides the usual backup suffix.
- -v, —verbose prints the name of each directory as it’s created.
- -z, —context-CONTEXT sets SELinux security context of files and directories.
- —help displays help information and exits.
- —version outputs version information and exits.
The backup suffix is
unless set with —suffix or SIMPLE_BACKUP_SUFFIX environment variable. The version control method may be selected using the —backup option or through the VERSION_CONTROL environment variable.
These are the values:
- none, off never make backups (even if —backup is given).
- numbered, t makes numbered backups.
- existing, nil is numbered if numbered backups exist: otherwise; it’s simple.
- simple, never always make simple backups.
The full documentation for the install command is maintained as a Texinfo manual. If the info and install programs are properly installed at your site, the command info install should access the complete manual.
Use the man command (man) to see how a command is used on your computer.
Example of the Install Command
The following command offers an example of how to use the install Linux command to copy files. Each folder and file should be customized for your situation.
Here, the -D option is used to copy the .py files from the /source/folder to the /destination/folder folder. Again, everything but install and -D should be altered to fit your files and folders.
If you need to make the destination folder, use this command, for example:
Источник
install(1) — Linux man page
Synopsis
Description
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).
In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY, while setting permission modes and owner/group. In the 4th form, create all components of the given DIRECTORY(ies).
Mandatory arguments to long options are mandatory for short options too. —backup[=CONTROL] make a backup of each existing destination file -b like —backup but does not accept an argument -c (ignored) -C, —compare compare each pair of source and destination files, and in some cases, do not modify the destination at all -d, —directory treat all arguments as directory names; create all components of the specified directories -D create all leading components of DEST except the last, then copy SOURCE to DEST -g, —group=GROUP set group ownership, instead of process’ current group -m, —mode=MODE set permission mode (as in chmod), instead of rwxr-xr-x -o, —owner=OWNER set ownership (super-user only) -p, —preserve-timestamps apply access/modification times of SOURCE files to corresponding destination files -s, —strip strip symbol tables —strip-program=PROGRAM program used to strip binaries -S, —suffix=SUFFIX override the usual backup suffix -t, —target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY -T, —no-target-directory treat DEST as a normal file -v, —verbose print the name of each directory as it is created -P, —preserve-context (SELinux) preserve security context -Z, —context=CONTEXT (SELinux) set security context of files and directories —help display this help and exit —version output version information and exit
The backup suffix is ‘
‘, unless set with —suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the —backup option or through the VERSION_CONTROL environment variable. Here are the values: none, off never make backups (even if —backup is given) numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backups
Author
Reporting Bugs
Copyright
See Also
should give you access to the complete manual.
Источник
What is the purpose of the ‘install’ command?
I’ve seen the install command used in a lot of Makefiles, and its existence and usage are kind of confusing. From the manpages, it seems like a knockoff of cp with less features, but I assume it wouldn’t be used unless it had some advantage over cp . What’s the deal?
4 Answers 4
install not only copies files but also changes its ownership and permissions and optionally removes debugging symbols from executables. It combines cp with chown , chmod and strip . It’s a convenient higher-level tool to that accomplishes a common sequence of elementary tasks.
An advantage of install over cp for installing executables is that if the target already exists, it removes the target file and creates a new one. This gets rid of any current properties such as access control lists and capabilities, which can be seen both as an upside and as a downside. When updating executables, if there are running instances of this executable, they keep running unaffected. In contrast, cp updates the file in place if there is one. On most Unix variants, this fails with the error EBUSY¹ if the target is a running executable; on some it can cause the target to crash because it loads code sections dynamically and modifying the file causes nonsensical code to be loaded.
install is a BSD command (added in 4.2BSD, i.e. in the early 1980s). It has not been adopted by POSIX.
¹ “Text file busy”. In this context, “text file” means “binary executable file”, for obscure historical reasons.
Источник