mkdir (GNU) Cheatsheet #
The mkdir
command is used to create directories in Unix-like operating systems.
Basic Commands #
Command/Option | Example | Description |
---|---|---|
mkdir dir | mkdir newdir | Create a directory named newdir |
mkdir -p dir/subdir | mkdir -p parentdir/childdir | Create parent directories as needed |
mkdir -m 755 dir | mkdir -m 755 newdir | Create a directory with specified permissions |
mkdir -v dir | mkdir -v newdir | Verbose mode, show each directory created |
Advanced Options #
Command/Option | Example | Description |
---|---|---|
mkdir --mode=755 dir | mkdir --mode=755 newdir | Create a directory with specific permissions (alternative syntax) |
mkdir --parents dir/subdir | mkdir --parents parentdir/childdir | Create intermediate directories if they do not exist |
mkdir --verbose dir | mkdir --verbose newdir | Show the directory creation process in detail |
This cheatsheet covers essential GNU mkdir
options for creating directories.