KIM COMPUTER


mkdir (Make Directory)

The mkdir command stands for Make Directory. It is used to create one or more new directories (folders) in the Linux file system.


1. Basic Usage

mkdir [options] directory_name

2. Key Options

Option Name Description
-p parents Create Parents. Creates nested subdirectories even if the parent folders don't exist yet.
-m mode Set Mode. Sets the file mode (permissions) at the time of creation (e.g., 755).
-v verbose Verbose. Displays a message for every directory successfully created.

3. Practical Examples

① Creating Nested Directories at Once

Use the -p flag to create an entire directory tree in a single command.

mkdir -p app/models/schemas

② Creating Multiple Directories

mkdir dev stage prod

③ Creating a Directory with Specific Permissions

Creates a folder where only the owner has read, write, and execute permissions.

mkdir -m 700 secret_vault

4. [Tip] Power of Brace Expansion

Quickly generate a series of directories with a specific pattern.

mkdir logs_{Jan,Feb,Mar}
# Result: Creates folders named logs_Jan, logs_Feb, and logs_Mar.