Backup file, create directory and set perms in one quick shot

Prior to working on/modifying a file, use the ‘install -m’ command which can both copy files, create directories, and set their permissions at the same time. Useful when you are working in the public_html folder and need to keep the copied file hidden from the world.

#install -m 0400 foo bar/

#install -m 0400 a.txt{,.bak}
-rw-r--r-- 1 user user 653 Feb 27 14:26 a.txt
-r-------- 1 root root 653 Feb 27 15:58 a.txt.bak

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.