Categories: TutorialsUbuntu

Mkdir Command in Linux

Introduction

mkdir command stands for make directory allows the user to create an empty directory on Linux operating system. This command can also create multiple folders at once as well as set permissions for folders. Of course, pay attention to the permission to create the user’s directory when standing in the parent directory or not? Otherwise, you will get an error message about permission denied.

And the article below, we will show you how to use the mkdir command through several examples as go through below.

The syntax of mkdir command

$ mkdir [options] name

For example, I will create a directory named linuxer:

$ mkdir linuxer
Sponsored

Output:

options

–version check your version

$ mkdir --version

Output:

–help display help information

$ mkdir --help

Output:

-v show folder creation process

Sponsored
$ mkdir -v [name]

Output:

-p create a directory with parent directory level

$ mkdir -p [name]

For example, I will create the linux1 directory inside the linux2 directory:

$ mkdir -p -v linux1/linux2

Output:

-m create folders with specific permissions

$ mkdir -m [permission_value] name

For example, I want to create a directory named best with all permission:

$ mkdir -m a=rwx best

Conclusion

In this tutorial, we guided you on how to use the mkdir command with some examples.

Thanks for reading!

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Ubuntu Server Admin

Recent Posts

Install FreePBX and Asterisk on Ubuntu 24.04 LTS for security patches until 2036

Deploying FreePBX and Asterisk on a single Ubuntu virtual machine in a public cloud is…

10 hours ago

Certification as a strategy: How Ubuntu & SystemReady boost hardware competitiveness

Canonical and MediaTek enhance reliability, accelerate market entry and reduce Total Cost of Ownership (TCO)…

10 hours ago

Ubuntu 20.04 LTS on Azure: how to stay secure after standard support ends

As Ubuntu 20.04 LTS (Focal Fossa) standard support ends on May 31, 2025, Azure users…

10 hours ago

Ubuntu Weekly Newsletter Issue 881

Welcome to the Ubuntu Weekly Newsletter, Issue 881 for the week of February 23 –…

1 day ago

Experiment Tracking with MLFlow in Canonical’s Data Science Stack

Welcome back, data scientists! In my previous post, we explored how easy it is to…

1 day ago

How to Install vLLM on Linux Using 4 Easy Steps

In this article, we will see how to install vLLM on Linux using 4 easy…

2 days ago