mkdir — create directories
Command to create new folders. Nested creation (-p), permission setting (-m), deployment structure creation examples, and execution screen.
💬 "mkdir command"
- Concept: Short for Make Directory, it creates a new directory.
- Output structure: On success, it outputs nothing. If a parent folder does not exist, an error occurs.
- Recommended output in practice: To create multiple levels at once, use
mkdir -p a/b/c; for folders that need permissions, also use-m. - Left column: Not applicable — check the permissions of the created folder with
ls -ld. - Right column: Not applicable — if it already exists, a
File existserror is printed.
3 Essential Command Combinations
mkdir build— create a single foldermkdir -p releases/2026-10-17/conf— create intermediate paths in one gomkdir -m 750 uploads— create with specified permissions
Here are some useful options to know as well.
-pskips without error even if it already exists- For locations that need security, such as upload folders, restrict permissions with
-m 750
💬 "Show me a real-world example used for server management"
Scenario: The process of creating an upload folder with restricted permissions.
Step 1: Create the folder
Create it with permissions 750.
mkdir -m 750 uploads
Step 2: Check permissions
Check that the permissions are as intended.
ls -ld uploads
Step 3: Add subfolders
Create the necessary subfolders.
mkdir -p uploads/tmp && ls -ld uploads/tmp
Actual execution screen
Example screen showing folders created with mkdir -p and -m.
!mkdir command execution result: created folder structure and permissions
Actual production server
Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/mkdir.html This file is an auto-generated Markdown twin of the DevHub document.
AI Knowledge Hub
Visitor Comments