Linux Commands Helper
💬 Your AI-powered Linux assistant
mkdir Command - Create Directories
The mkdir command is used to create new directories in the file system.
Syntax
mkdir [options] directory_name
Common Options
-p
: Create parent directories as needed without error.-v
: Print a message for each created directory.--mode=MODE
: Set permission mode for the new directory.
Examples
mkdir newdir
Create a directory named newdir in the current location.
mkdir -p /home/user/docs/newdir
Create the directory /home/user/docs/newdir along with any necessary parent directories.
mkdir -v mydir
Create mydir and display a message confirming creation.
Notes
- The mkdir command will fail if the specified directory already exists (unless using
-p
). - Permissions of new directories depend on the current umask and any specified mode.