How to use the mkdir command in Linux


mkdir command in Linux allows the user to create directories (also referred to as folders in some operating systems ). This command can create multiple directories at once as well as set the permissions for the directories.

New Directory
mkdir newdir
mkdir --help
info mkdir
man mkdir
version information
mkdir --version
mkdir (GNU coreutils) 8.22

How to Create Parent Directories

make parent
mkdir -p /data/go
print a message
mkdir -v -p /data/go
mkdir: created directory ‘folder’

The syntax for the mkdir command is as follows:

  mkdir [OPTION]... DIRECTORY...

-m, --mode=MODE
set file mode (as in chmod), not a=rwx - umask
-p, --parents
no error if existing, make parent directories as needed
-v, --verbose
print a message for each created directory
set SELinux security context of each created directory to the default type
like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX
display this help and exit
output version information and exit

Related Tags

#Linux# #mkdir#