install — Copy Files and Set Attributes

The install command copies files while setting ownership, permissions and target directories in one step. It is commonly used in build scripts and deployment tasks.

Copy a file with permissions

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

Create a directory with permissions

install -d -m 755 /opt/myapp

For system locations such as /usr/local/bin, you may need appropriate privileges. Always check the target path before copying files.

Leave a Comment