'install' command: copy files while changing permissions and owners
Table of Contents
The ‘install’ command allows to copy files and set attributes to the copied files using a very straightforward syntax.
Basic usage
Copy from <SOURCE> to <TARGET>:
install <SOURCE> <TARGET>
install file1 file2
By default, install set the following permissions on the copied file: rwxr-xr-x or 755. Check the following section to know how to change that. <TARGET> can be a directory or a file.
Parameters
You need root permissions to change some file attributes (like the owner).
-m <permissions>: set file permissions (using a numeric code).
install -m 600 file1 out/file2
-o <owner>: set the file owner.-g <group>: set the file group.
install -m 600 -o ricardo -g ricardo file1 file2
-p: preserve timestamps.
Test with this online terminal:
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: