What is the Mkdir Command in Linux and How to Use It?

04 May 2023 Balmiki Mandal 0 Linux

What is the Linux 'mkdir' Command?

The Linux 'mkdir' command is used to create directories. This command will allow you to create directories and subdirectories, as well as assign permissions to them. The mkdir command is one of the most commonly used commands in Linux, and it is a great tool for managing your system.

How to Use the 'mkdir' Command

Using the 'mkdir' command is quite straightforward. All you need to do is specify the name of the directory that you want to create. For example, if you wanted to create a directory called ‘my_folder’:

$ mkdir my_folder

You can also use the '-p' flag when running 'mkdir' to create multiple levels of directories at once. For example, if you wanted to create a directory called ‘my_folder’ with a subdirectory called ‘my_sub_folder’:

$ mkdir -p my_folder/my_sub_folder

Furthermore, you can set the permissions of each directory by using the '-m' flag. For example, if you wanted to set the permissions of the ‘my_folder’ directory to 755:

$ mkdir -m 755 my_folder

Conclusion

In conclusion, the 'mkdir' command is an incredibly useful command for creating directories and subdirectories, as well as setting permissions on those directories. It is a must-know command for any Linux user.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.