en
  English
Phone :  +370 (5) 204-1903
Email: sales@1gbits.com
  1. Dedicated server
  2. Blog
  3. How to use MKDIR command in Linux

How to use MKDIR command in Linux

In this article, we are going to explain what Mkdir Command is, and we will give various examples of how it can be used - all in a beginner-friendly tone of voice.

Linux Tutorial Apr 15, 21 by Nisal N 7 min Read
How to use MKDIR command in Linux

Whether it’s for personal or for work stuff, everyone loves to create folders on their computers to keep things organized in one place. Most people would start in just one folder to curate their files intended for personal purposes until they couldn’t stop themselves at all from creating one after another. 

Well, who would hesitate to keep their desktops tidy and nice if generating folders is just as easy as two to three clicks?

However, sorting out a bunch of computer files is not always as therapeutic as it may seem. Uncommon operating systems such as Unix and Linux have another way of doing this in a more complicated procedure. 

If macOS and Windows allow you to create folders in just a few clicks, Linux and Unix would require some technical coding skills for you to generate one. One of the most used commands in the procedure is mkdir. 

Unix & Linux Explained

Before discussing the mkdir command, it’s important to know what exactly these Unix and Linux are. Are they the same?

Every computer has its operating system, which makes them run and process various programs. The most common OS being used around the world are Windows by Microsoft and macOS by Apple. But aside from these two systems, there are also what computer geeks called Linux and Unix. 

Linux is widely known as an open-source operating system. Unlike Windows and macOS that require a sort of paid activation key, Linux has granted anyone access to its system for any purposes without any charge. 

It has been named the most popular OS on earth despite Microsoft and Apple’s dominance in most computers today. In case you’re not aware, devices that have been a huge part of everyone’s daily lives, such as Android phones, high-tech cars, smart appliances, and company servers, are powered by Linux. 

This operating system, unknown to many, hosts the world’s top supercomputers and even the stock exchange. Amazing, right? 

But right before Linux was born, there was another operating system that tried to change the world. Bell Labs Research introduced Unix in the 1970s as an OS for computers that run multi-user programs. 

Back then, Unix was able to pave its way towards worldwide popularity for being the first compact operating system designed in C Programming Language. However, its fame started to fade away when Linux began to rise in 1994 as Unix’s free clone. 

Linux and Unix have many similarities, so it’s no surprise that many people can’t still exactly differentiate the two up until today. But to mention a few differences, Linux is completely free while Unix provides access to copyright holders only. Unix is compatible with some computer files but lesser compared to what Linux can support. 

When it comes to devising security, both of them almost provide the same level of cyber protection.

PS: here's how you can fortify your accounts with the perfect password.  

If you get used to Windows or macOS for a long time, navigating through Unix and Linux’s interface will surely bring you to an extremely different world. Simple tasks such as creating a folder for your files will suddenly become an unfriendly errand. 

If such kind of easy tasks only takes you a few minutes to complete on your MacBook, Unix and Linux will ask more time than you expect. You have to go into your gadget’s user command and enter the mkdir command on the designated line. Does it sound foreign to you? It’s alright! Take it slowly and read through the step-by-step guide below. 

What is Mkdir Command?

In the simplest explanation, mkdir or ‘make directory’ is a typical code used to produce new directories on devices powered by Linux or Unix. If this seems unclear, the directory is the Unix and Linux’s counterpart for macOS and Window’s folder. It also has the purpose of storing, preserving, and protecting files installed on the computer. 

However, directories are far different from folders when it comes to the files they curate. Directories are most often used for keeping sensitive and confidential data, including rosters of diverse file names as well as their equivalent inode numbers. There are quite a number of important directories in Linux

Every inode number in the system represents a specific inode that holds all the relevant information about the file. It synchronizes all the computer data on the operating system. 

Aside from generating directories for new loads of incoming files, the mkdir command also allows the users to assign access and creation permission for each directory. Before a user can create directories to your computer using the mkdir command, he first needs to seek consent from the parent directory; otherwise, his attempt will be instantly denied. 

Are you ready to create your very first directory? Read through the guide below and run your fingers like a PRO. 

Ultimate Guide in Using Mkdir Command For Various Purposes

Here’s how you can create a brand new directory on your Linux or Unix device: 

  • The syntax you’re going to use in performing this command is: 

mkdir [OPTION]... DIRECTORY...

  • This is how the syntax should mean:

Generate the DIRECTORY(ies) if they don’t yet exist.

  • Pass the name of the directory you’re about to generate to the mkdir command. See the example below. 

mkdir [dir-name]

mkdir test-dir

You can also create multiple directories on your device at once. Here’s how:

  • Pass the file names of the directories you’re about to create to the mkdir command. File names need to be separated by spaces. See the example below: 

mkdir goo aar raz

Ls

goo aar raz

Mkdir command can also show the complete details regarding the operations it’s about to perform. Here’s how: 

  • Mkdir can disclose details about its operations using the option called v- line command. 

mkdir -v [dir]

In A Nutshell

Whether it’s about creating a folder or a directory, it’s always important to keep essential computer files in a safe and secure place. They are virtual assets, so losing them once would mean losing them forever. Use the guide above and take every pointer seriously. Creating directories using the mkdir command will then become as easy as creating folders on Windows and macOS. Go and explore!

To learn more about Linux commands, have a look here

author img

Nisal N

Computers has always fascinated me since I was a kid and here we are. I love travelling for 2 reasons: the first one to see a new part of the world and second (the most important one) to experience the rich culture hidden among the country and people. I'm pretty good at cooking but very poor when it comes to baking.

Leave A Comment