DEV Community

Cover image for Linux Commands for Beginners: mkdir Explained
Sunil Pradhan
Sunil Pradhan

Posted on

Linux Commands for Beginners: mkdir Explained

When I started using Linux Mint, I often copied terminal commands from tutorials without really understanding what they meant.

One of the first commands I came across was:

mkdir -p ~/.config/ulauncher/user-themes
Enter fullscreen mode Exit fullscreen mode

At first, it looked confusing.

What does -p mean? What is ~? Why is there a dot (.) before config?

In this post, I'll explain each part in the simplest way possible.

What is mkdir?

mkdir stands for Make Directory.

It is used to create a new folder.

Example:

mkdir Documents
Enter fullscreen mode Exit fullscreen mode

This creates a folder named Documents.

What does -p mean?

The -p option tells Linux:

"Create parent folders if they don't already exist."

Imagine you want to create this folder structure:

Projects/
└── Python/
└── MyApp/

If none of these folders exist and you run:

mkdir Projects/Python/MyApp
Enter fullscreen mode Exit fullscreen mode

Linux will return an error because the Projects folder doesn't exist.

Instead, use:

mkdir -p Projects/Python/MyApp
Enter fullscreen mode Exit fullscreen mode

Now Linux creates all the missing folders automatically.

Another benefit is that if the folders already exist, mkdir -p won't show an error.

What does ~ mean?

The ~ (tilde) is a shortcut for your Home directory.

For example, if your username is sunil, then:

~
Enter fullscreen mode Exit fullscreen mode

is the same as:

/home/sunil
Enter fullscreen mode Exit fullscreen mode

You can check this yourself by running:

echo ~
Enter fullscreen mode Exit fullscreen mode

Example output:

/home/sunil
Enter fullscreen mode Exit fullscreen mode

What is .config?

Folders that begin with a dot (.) are hidden folders in Linux.

The .config folder stores configuration files for many applications.

For example:

~/.config
├── brave
├── code
├── gtk-4.0
├── ulauncher
└── ...

Many Linux applications save their settings here.

Putting It All Together

Let's look at the original command again:

mkdir -p ~/.config/ulauncher/user-themes
Enter fullscreen mode Exit fullscreen mode

Here's what each part means:

Part Meaning
mkdir Create a folder
-p Create parent folders if needed
~ Your Home directory
.config Hidden configuration folder
ulauncher/user-themes The folders to create

So the command simply means:

Create the user-themes folder inside ~/.config/ulauncher. If any of the parent folders don't exist, create them too.

The final folder structure will look like this:

/home/your-username
└── .config
└── ulauncher
└── user-themes

Beginner Tip

Whenever you see a Linux command, don't just copy and paste it.

Try breaking it into smaller parts:

  • What is the command?
  • What do the options (-p, -r, -f, etc.) mean?
  • Where is the command working?
  • What will change after running it?

Understanding commands instead of memorizing them makes learning Linux much easier.

Final Thoughts

When I first saw mkdir -p ~/.config/ulauncher/user-themes, it looked intimidating.

After breaking it down, I realized it's simply telling Linux to create a folder inside my Home directory and automatically create any missing parent folders.

As a Linux beginner, I've found that understanding one command at a time builds confidence much faster than memorizing dozens of commands.

Top comments (0)