Linux mkdir command

mkdir is used to create directories(folders).

Syntax:

mkdir [Directory_name]

Example:

$mkdir k2schools

Options:

Option Description
-m set file mode (as in chmod), not a=rwx – umask
-p no error if existing, make parent directories as needed
-v print a message for each created directory
-z set the SELinux security context of each created directory to CTX

More Examples:

To create multiple directories using mkdir

mkdir class1 class2 class3 class4 -v

Linux mkdir command
To create nested directories

mkdir -p class1/linux/shellscripting -v

Linux mkdir command1
To get the list of files/directories

ls

To get the list of files/directories with sub directories/files

ls -R

Linux mkdir command2

Powered by k2schools
Skip to toolbar