Create directory & set permission using a single Linux command

Generaly, we create directory using “mkdir” command and then change it’s permissions using “chmod” command.

Actually, we can set the permissions for the directory at the time of it’s creation itself, with the following command:

$ mkdir zyz -v -m 644
mkdir: created directory `zyz'


-m flag defines the permission to be set
-v stands for verbose mode

$ ls -l | grep zyz
drw-r--r--  2 root root  4096 2009-12-30 14:26 zyz

To get updates follow us on Facebook, Twitter, LinkedIn

Subscribe to get free blog content to your Inbox