The fastest way to create a folder in Linux
To create a folder in Linux, type mkdir followed by the name you want. Open your terminal, then type this command exactly:
mkdir my-folder
Press Enter. The folder appears in your current location. That is the whole process. If you want to name it something else, replace "my-folder" with your chosen name — use hyphens or underscores instead of spaces, because spaces in folder names create problems later when you are navigating from the command line.
If you want to create the folder somewhere other than where you are right now, add the path before the name: mkdir ~/Documents/my-folder creates it inside your Documents folder. The tilde (~) means your home directory.
Key Takeaways
- The mkdir command creates a single folder: type mkdir folder-name and press Enter.
- Use hyphens or underscores in folder names instead of spaces to avoid command-line problems later.
- Create nested folders (folders inside folders) in one command with mkdir -p path/to/nested/folder.
- If a folder already exists, mkdir will tell you and do nothing, so you can safely run the command twice.
Creating multiple nested folders at once
If you need to build a folder structure — say, a Projects folder with subfolders for Work and Personal, each with their own Archive subfolder — you can create all of them in one command instead of running mkdir four times.
Use the -p flag (which stands for "parents"). Type:
mkdir -p Projects/Work/Archive Projects/Personal/Archive
This creates Projects, then Work and Personal inside it, then Archive inside each of those. The -p flag tells mkdir to create parent folders if they do not exist yet. Without it, the command would fail if Projects did not already exist.
You can chain as many paths as you want in a single command, separated by spaces. This saves time when you are setting up a new project structure.
Checking what you created
After you create a folder, you can see it when ready by typing ls (list) to see everything in your current location, or ls -l to see more details including when it was created.
If you created the folder somewhere else, navigate to it first with cd (change directory). For example, cd ~/Documents takes you into Documents, then ls shows you what is there.
You can also use a graphical file manager — the folder icon in your taskbar — to see your new folders the same way you would on Windows or Mac. The command line and the file manager show the same folders; they are just two different ways to look at the same thing.
What happens if the folder already exists
If you run mkdir with a name that already exists, Linux tells you the folder exists and does nothing. It does not overwrite or delete the existing folder. This means you can safely run the same mkdir command twice without worry.
If you want to check whether a folder exists before creating it, you can use mkdir -p, which creates the folder only if it does not exist. This is useful in scripts or when you are not sure whether you have already created it.
Naming folders so you can find them later
Folder names in Linux are case-sensitive, meaning "Documents" and "documents" are two different folders. Pick one style and stick with it. Most people use lowercase with hyphens: my-project, tax-2024, client-files.
Avoid special characters like asterisks, question marks, slashes, or quotation marks — they have special meaning in the terminal and will cause errors. Stick to letters, numbers, hyphens, and underscores. If you need to separate words, use hyphens (my-folder) rather than spaces, because spaces require you to put quotes around the name every time you reference it from the command line.
Make folder names descriptive enough that you remember what is in them six months from now. "2024-tax-documents" is better than "stuff" or "temp".
Moving and renaming folders after you create them
Once a folder exists, you can rename it with the mv command (move). Type mv old-name new-name to rename it in place. You can also move it to a different location: mv my-folder ~/Documents/my-folder moves it into Documents.
If you want to delete a folder you created by mistake, use rmdir folder-name — but only if the folder is empty. If it has files in it, you need rm -r folder-name instead, which deletes the folder and everything inside it. Be careful with this command; deleted files do not go to a trash bin in Linux — they are gone.
Using the graphical file manager instead
If you prefer not to use the terminal, you can create folders the same way you do on Windows or Mac. Open your file manager, navigate to where you want the folder, right-click in the empty space, and select "Create Folder" or "New Folder". Type the name and press Enter.
The graphical method is slower if you need to create many folders or a complex structure, but it is simpler if you are just making one or two. Both methods create the exact same folders — the terminal is just faster once you are comfortable with it.
Frequently Asked Questions
Can I use spaces in folder names?
You can, but it makes the terminal harder to use. If you create a folder called "my folder" with a space, you have to type "my folder" in quotes every time you reference it from the command line. Use hyphens or underscores instead: my-folder or my_folder.
What is the difference between mkdir and mkdir -p?
mkdir creates a single folder and fails if the parent folder does not exist. mkdir -p creates all parent folders if needed and does nothing if the folder already exists. Use -p when you are building a nested structure or when you are not sure whether the parent folder exists.
How do I create a folder on my Desktop?
Type mkdir ~/Desktop/folder-name. The Desktop folder is inside your home directory, so the tilde (~) gets you there. You can also navigate to the Desktop first with cd ~/Desktop, then type mkdir folder-name.
Can I undo a folder creation?
If the folder is empty, type rmdir folder-name to delete it. If it has files inside, use rm -r folder-name. There is no undo in Linux, so be certain before you run the delete command.
Why does mkdir sometimes say "permission denied"?
You do not have write permission in that location. Try creating the folder in your home directory instead: mkdir ~/my-folder. If you need to create a folder in a system location, you may need to use sudo, but that is beyond basic folder creation.