The mkdir command
The mkdir command in Linux/Unix is used to create a directory.
Syntax
mkdir [-m=mode] [-p] [-v] [-Z=context] directory [directory...]Examples:
Make a directory named
myfiles.
[root@academy tmp]# ls
ks-script-ggLlAt yum.log
[root@academy tmp]# mkdir myfiles
[root@academy tmp]# ls -l
total 4
-rwx------. 1 root root 836 Dec 13 14:30 ks-script-ggLlAt
drwxr-xr-x. 2 root root 6 Dec 22 22:31 myfiles
-rw-------. 1 root root 0 Dec 13 14:23 yum.log
[root@academy tmp]#Create a directory named
myfiles at the home directory:
[root@academy tmp]# mkdir ~/myfiles
[root@academy tmp]# ls ~
anaconda-ks.cfg myfiles
[root@academy tmp]#Create the
mydirdirectory, and set its file mode (-m) so that all users (a) may read (r), write (w), and execute (x) it.
Create the directory
/home/test/src/python. If any of the parent directories/home,/home/test, or/home/test/srcdo not already exist, they are automatically created.
Last updated