Create directory and set permissions for the directory using single command in Linux

Generaly we create a 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