mkdir

mkdir

This command will create a directory with read/write/execute rights(0777). Of course it only makes sense that you must have write permissions to the directory in which you will create the new folder.


Example:

mkdir stuff


When you use the command ls -la you see the directory is created with read/write/execute rights. The owner is the user who created the directory.


drwxr-xr-x 2 mike mike 4096 2005-08-06 11:05 stuff


The mkdiir command has an option to modify the mode from 777 (read/write/execute permissions) to any mode you would like. That option is -m.


mkdir -m 444 stuff


dr--r--r-- 2 mike mike 4096 2005-08-06 11:08 stuff


The difference here is that the directory was created as read only (444). This saves the step of modifying the permissions after the directory is created.


The other option that is very useful is to create a directory tree of folders in one command, use the -p option for this process.



mkdir -p tech/docs/projects


mike@ub:~$ ls tech

docs

mike@ub:~$ ls tech/docs/

projects


This shows that the folders were created and are visible with the ls command.