Linux mkdir for Make Directory with -m and/or -p

linux Make Directory command mkdir

-m is for Permissions (becauseĀ -p was taken for parents)

-m is for permissions. By default, new directories are created with the read, write and execute permissions enabled for the owner of the directory and group and the read and execute permissions enabled for other users.

To create a directory named some_dir_example01 that has wide open to the world permissions, the sequence 777 would be employed after -m, for example:

The first digit represents the owner, the second represents the group and the third represents other users. The number 7 represents all three types of permission (i.e., read, write and execute), 6 stands for read and write only, 5 stands for read and execute, 4 is read only, 3 is write and execute, 2 is write only, 1 is execute only and 0 is no permissions.

To create a new directory named some_dir_example02 for which the owner has read and write permissions, the group has read permission and other users have no permissions, the following would be used:

-p is for parents

The -p ( for parents) option creates the intermediate directories specified for a new directory if they do not already exist.

Leave a Reply

Your email address will not be published. Required fields are marked *