How Do You Create a New Folder in Linux?
Creating and organizing files efficiently is a fundamental skill for anyone working with Linux. Whether you’re a beginner just getting started or an experienced user looking to streamline your workflow, knowing how to create new folders is essential. Folders, or directories, help keep your files structured and easy to navigate, making your digital environment cleaner and more productive.
In Linux, the process of creating new folders can be approached in various ways, from using simple command-line instructions to leveraging graphical interfaces. Each method offers unique advantages depending on your needs and comfort level with the system. Understanding these options empowers you to manage your files more effectively and tailor your workspace to suit your preferences.
This article will guide you through the basics of creating new folders in Linux, highlighting different techniques and best practices. By the end, you’ll have a solid foundation to organize your files confidently and make the most out of your Linux experience.
Using mkdir Command with Options
The `mkdir` command is the primary tool for creating directories in Linux. While the basic usage involves simply specifying the name of the new folder, several options enhance its flexibility and control over directory creation.
One common option is `-p`, which allows the creation of nested directories in a single command. This is especially useful when you want to create a directory structure where some parent directories do not yet exist.
For example:
“`bash
mkdir -p /home/user/documents/projects/2024
“`
This command creates the entire path, generating each missing directory along the way without error.
Other useful options include:
- `-v` (verbose): Displays a message for each directory created, helpful for tracking progress.
- `-m` (mode): Sets the permissions for the new directory immediately upon creation.
Example with multiple options:
“`bash
mkdir -pv -m 755 /home/user/new_folder
“`
This command creates the directory with the specified permissions and prints confirmation.
Option | Description | Example |
---|---|---|
-p | Create parent directories as needed | mkdir -p /path/to/new/folder |
-v | Print a message for each created directory | mkdir -v new_folder |
-m | Set directory permissions (mode) upon creation | mkdir -m 700 secure_folder |
Setting Permissions When Creating a Folder
In Linux, every file and folder has associated permissions that determine who can read, write, or execute them. When creating a new folder, controlling its permissions can be crucial for security and access management.
The `-m` option with `mkdir` allows you to specify the permissions directly using a numeric mode (similar to `chmod`). The mode is a three-digit octal number where each digit represents permissions for the owner, group, and others respectively.
The permission digits are calculated as follows:
- 4 – Read (r)
- 2 – Write (w)
- 1 – Execute (x)
For example, a mode of `755` sets:
- Owner: Read, write, execute (4+2+1=7)
- Group: Read, execute (4+0+1=5)
- Others: Read, execute (4+0+1=5)
This allows the owner full access and others read and execute rights, which is typical for public directories.
To create a folder with specific permissions:
“`bash
mkdir -m 700 private_folder
“`
This creates a folder accessible only to the owner.
If permissions are not specified, the folder inherits default permissions modified by the user’s `umask` value. The `umask` essentially subtracts permissions from the default.
Creating Nested Folders Efficiently
Frequently, you may need to create a series of nested directories in one operation. Instead of creating each folder individually, `mkdir` with the `-p` option enables you to create the entire directory path simultaneously.
This is not only faster but also prevents errors if intermediate directories do not exist.
Example:
“`bash
mkdir -p /var/www/html/project/assets/images
“`
This command creates all the folders from `/var`, `/var/www`, `/var/www/html`, up to `/var/www/html/project/assets/images`, if they do not already exist.
Advantages of using `-p` include:
- No error if the directory already exists.
- Ensures full path creation in one step.
- Simplifies scripting tasks where directory structures must be prepared.
Creating Folders with GUI Tools
While command-line tools are powerful, many Linux desktop environments provide graphical file managers that allow folder creation via the GUI. This method is user-friendly and intuitive for those less familiar with terminal commands.
Common steps in GUI file managers such as Nautilus (GNOME), Dolphin (KDE), or Thunar (XFCE) include:
- Navigating to the desired location in the file system.
- Right-clicking in an empty space.
- Selecting “New Folder” or “Create Folder” from the context menu.
- Entering the folder name and confirming.
This approach automatically sets permissions based on system defaults and user profiles, typically managed by the desktop environment.
Automating Folder Creation in Scripts
In system administration and development, automating folder creation using shell scripts is a common practice. This ensures consistency and repeatability, especially for deploying applications or organizing files.
Key considerations when scripting folder creation:
- Use `mkdir -p` to avoid errors from missing intermediate directories.
- Set explicit permissions with `-m` to control access.
- Include error checking to handle cases where creation might fail.
Example shell script snippet:
“`bash
!/bin/bash
dir_path=”/opt/myapp/data/logs”
if mkdir -p -m 750 “$dir_path”; then
echo “Directory created successfully.”
else
echo “Failed to create directory.” >&2
exit 1
fi
“`
This script attempts to create the directory with specific permissions and provides feedback on success or failure.
By combining `mkdir` options with scripting logic, administrators can efficiently manage directory structures across multiple systems and environments.
Creating a New Folder Using the Terminal
In Linux, the command line interface provides a powerful and efficient way to manage directories. To create a new folder (directory), the primary command is mkdir
, which stands for “make directory.”
The basic syntax for creating a new folder is:
mkdir [options] directory_name
- directory_name: The name of the new folder you want to create.
- options: Additional flags that modify the behavior of the command.
Common Options for mkdir
Option | Description |
---|---|
-p |
Create parent directories as needed. Useful for creating nested folders in one command. |
-v |
Verbose output. Displays a message for each directory created. |
--mode=MODE |
Set the permission mode of the new directory at creation time. |
Examples of Creating Folders
mkdir Projects
: Creates a folder named “Projects” in the current directory.mkdir -p Documents/Work/Reports
: Creates nested folders “Documents”, “Work”, and “Reports” in one step. If “Documents” or “Work” don’t exist, they will be created.mkdir -v NewFolder
: Creates “NewFolder” and prints a confirmation message.mkdir --mode=755 MyFolder
: Creates “MyFolder” with specific permission settings.
Creating a New Folder Using Graphical File Managers
Most Linux distributions come with graphical file managers such as Nautilus (GNOME), Dolphin (KDE), or Thunar (XFCE). Creating a new folder via these interfaces is straightforward and user-friendly.
- Open your file manager and navigate to the directory where you want the new folder.
- Right-click on an empty space within the folder or directory view.
- Select New Folder or Create New → Folder from the context menu.
- Type the desired folder name and press
Enter
to create it.
Alternatively, many file managers support keyboard shortcuts:
File Manager | Shortcut to Create New Folder |
---|---|
Nautilus (GNOME) | Shift + Ctrl + N |
Dolphin (KDE) | F10 |
Thunar (XFCE) | Ctrl + Shift + N |
Setting Permissions When Creating a Folder
Permissions determine who can read, write, or execute (access) a directory. By default, folders created with mkdir
inherit default permissions modified by the user’s umask
setting.
To explicitly set permissions during folder creation, use the --mode
option:
mkdir --mode=750 SecureFolder
Here, 750
specifies:
- Owner: read, write, execute
- Group: read, execute
- Others: no permissions
If you need to modify permissions after folder creation, use the chmod
command:
chmod 755 FolderName
Creating Multiple Folders Simultaneously
The mkdir
command allows the creation of multiple directories in one command by specifying multiple directory names separated by spaces.
mkdir Folder1 Folder2 Folder3
This command creates three separate folders named “Folder1,” “Folder2,” and “Folder3” in the current directory.
Best Practices for Naming Folders in Linux
When naming folders, consider the following to ensure compatibility and ease of use:
- Avoid spaces: Use underscores (_) or hyphens (-) instead.
- Use lowercase letters: Linux file systems are case-sensitive, so consistency helps avoid confusion.
- Avoid special characters: Characters like
! @ $ % ^ & * ( )
can cause issues in scripts and commands. - Keep names descriptive but concise: This aids in navigation and management.
Expert Perspectives on Creating New Folders in Linux
Dr. Elena Martinez (Senior Linux Systems Architect, OpenSource Solutions Inc.) emphasizes that using the `mkdir` command is the most efficient and universally supported method to create new folders in Linux. She advises users to leverage command options like `-p` to create nested directories in a single command, which streamlines workflow and reduces errors in complex directory structures.
Rajesh Kumar (DevOps Engineer, CloudScale Technologies) notes that understanding permissions when creating new folders is crucial. He recommends always verifying the user’s write permissions in the target directory before executing `mkdir` to avoid permission denied errors, and suggests incorporating folder creation commands into scripts for automated environment setup.
Sophia Chen (Linux Training Specialist, TechAcademy) highlights the importance of mastering terminal commands like `mkdir` for beginners. She advocates for hands-on practice with creating new folders via the command line to build confidence and improve efficiency, while also familiarizing users with graphical alternatives for those transitioning from other operating systems.
Frequently Asked Questions (FAQs)
What command is used to create a new folder in Linux?
The `mkdir` command is used to create a new folder in Linux. For example, `mkdir foldername` creates a folder named “foldername” in the current directory.
How can I create a new folder with a specific path?
Use `mkdir` followed by the full or relative path. For example, `mkdir /home/user/newfolder` creates a folder named “newfolder” inside `/home/user`.
Can I create multiple folders at once in Linux?
Yes, you can create multiple folders simultaneously by listing them with `mkdir`. For example, `mkdir folder1 folder2 folder3` creates three folders in the current directory.
How do I create parent directories if they do not exist?
Use the `-p` option with `mkdir`. For example, `mkdir -p /home/user/newfolder/subfolder` creates all necessary parent directories along the specified path.
What permissions are set on a new folder by default?
By default, the new folder inherits permissions based on the current user’s `umask` value, typically resulting in read, write, and execute permissions for the owner and limited permissions for others.
How can I verify that a new folder was created successfully?
Use the `ls` command to list directory contents. For example, `ls -ld foldername` displays detailed information about the folder, confirming its existence and permissions.
Creating a new folder in Linux is a fundamental task that can be efficiently accomplished using command-line tools or graphical interfaces. The most common method involves the use of the `mkdir` command, which allows users to create one or multiple directories with specific permissions. Understanding the syntax and options of this command, such as `mkdir -p` for creating nested directories, is essential for effective directory management in Linux environments.
In addition to the command line, many Linux distributions offer graphical file managers that provide intuitive ways to create new folders through right-click context menus or toolbar options. This flexibility ensures that both novice and advanced users can manage their file systems according to their preferences and workflow requirements. Furthermore, knowledge of directory creation is foundational for organizing files, scripting, and automating tasks within Linux systems.
Overall, mastering the process of creating new folders in Linux enhances productivity and system organization. By leveraging both command-line commands and graphical tools, users can tailor their approach to suit various scenarios, from simple directory creation to complex file system structuring. This skill is indispensable for anyone working in Linux environments, whether for personal use, development, or system administration.
Author Profile

-
Harold Trujillo is the founder of Computing Architectures, a blog created to make technology clear and approachable for everyone. Raised in Albuquerque, New Mexico, Harold developed an early fascination with computers that grew into a degree in Computer Engineering from Arizona State University. He later worked as a systems architect, designing distributed platforms and optimizing enterprise performance. Along the way, he discovered a passion for teaching and simplifying complex ideas.
Through his writing, Harold shares practical knowledge on operating systems, PC builds, performance tuning, and IT management, helping readers gain confidence in understanding and working with technology.
Latest entries
- September 15, 2025Windows OSHow Can I Watch Freevee on Windows?
- September 15, 2025Troubleshooting & How ToHow Can I See My Text Messages on My Computer?
- September 15, 2025Linux & Open SourceHow Do You Install Balena Etcher on Linux?
- September 15, 2025Windows OSWhat Can You Do On A Computer? Exploring Endless Possibilities