mkdir
Commandmkdir
The mkdir
command is used to create new directories in Linux. The most basic form of the command is:
mkdir [directory_name]
This will create a directory with the specified name in the current working directory.
mkdir
mkdir
(Basic Usage)Creates a new directory in the current location:
mkdir new_folder
mkdir -p
(Create Parent Directories)Creates the directory and any necessary parent directories:
mkdir -p /home/user/new_folder/sub_folder
mkdir -v
(Verbose Mode)Prints a message for each directory that is created:
mkdir -v new_folder
Output:
mkdir: created directory 'new_folder'
mkdir -m
(Set Permissions)Creates a directory with the specified permissions:
mkdir -m 755 new_folder
mkdir --help
(Show Help)Displays help information for the mkdir
command:
mkdir --help
Option | Description |
---|---|
mkdir [directory_name] |
Creates a new directory. |
mkdir -p [path] |
Creates a directory and any necessary parent directories. |
mkdir -v [directory_name] |
Prints a message for each directory created. |
mkdir -m [mode] [directory_name] |
Creates a directory with the specified permissions. |
mkdir --help |
Displays help information. |
For more detailed information, use the manual page for the mkdir
command:
man mkdir