create directory in linux by mkdir command | Pro Tech guides

create directory in linux by mkdir command

The mkdir command in Linux allows users to create or make new directories. you can also set permissions, create multiple directories at once, and much

create directory in linux | mkdir command | with examples

mkdir command in linux
mkdir command in linux

Hey, guys welcome In this session, you will learn how you can use mkdir command in Linux. you can use mkdir command to create directories in Linux.

Let's see how you can do it so first of all just press "ctrl + alt + T" to open your terminal.

Create a directory or folder

mkdir command to create a directory
create a directory
$mkdir folder name

For example, I want to create a directory called image. so I can just give mkdir command. Which is the command to create any directory and then the name of the directory for example image and I will press ENTER. And then it's going to create this directory called image.


Create a subdirectory

Create a subdirectory using mkdir command
create a subfolder
$mkdir folderName/sub folderName

Now I want to create a subdirectory inside this image directory. I can just write mkdir once again and the directory name which already exists and then I will give the forward-slash (/) for the subdirectory. 

sub directory
subdirectory


For example, I want to create a subdirectory called picture so just say mkdir image/picture then I will press ENTER. and then when I open this image directory it has this picture directory.


Create a directory and subdirectory using a flag

Create a folder using flag
mkdir command flag

$mkdir -p folder/sub folder

If you want to create the subdirectory from the command or for the directory. which don't really exist. In order to create the directory structure, you need to use this "flag" to your "mkdir" command which is "-p" and this flag you can use to create a directory structure. 

So this flag can be given in two ways this is the short version (-p) of giving this flag and if you want to know the full version you can just give "--parents" and if you give this command it's going to create a directory for you also subdirectory for you. Which doesn't even exist. 

I'm going to just give this short flag which is "-p" and I will just press ENTER. And it's going to create this directory and when I go inside this directory there is one more directory called mark. So if you want to create a directory or subdirectory which doesn't really exist you can use "-p" with your "mkdir" command.


Create multiple sub-directories using mkdir

mkdir to create multiple folders
mkdir to create multiple folders

$mkdir -p folder/ {sub folders}

If you want to make or create several directories inside your parent directory. You can just write "mkdir -p" and For example, I want to create some directories with some names inside this names directory. 

So I will just give the name of the directory and then I will just give these curly brackets ({}) and inside the curly brackets, I can provide the list of the directories which I want to create. And press ENTER 

It will create these three directories so always remember "when you give a space it will not create the correct directory structure" you want. So you need to give the comma (,) without space. So this format of creating the multiple directories is correct without spaces 

Conclusion

So in this way you can use "mkdir" command in Linux.

I hope you've enjoyed this tutorial please rate command and bye for now.

HAVE A NICE DAY
See also,

Name

Apps,3,Games,1,Linux,38,Linux Commands,37,Network-Devices,1,Networking,1,Terminal Apps,2,Termux,17,Userland,3,Windows,1,
ltr
item
Pro Tech guides: create directory in linux by mkdir command
create directory in linux by mkdir command
The mkdir command in Linux allows users to create or make new directories. you can also set permissions, create multiple directories at once, and much
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkmqA8Gbil5TPSeFE6L42XppFd-q9M_PUPmQjduYxazNQb6GOg2MjwRjMOB0TH5l_9dTcT1O2pGXCorpxz75penkYMwYVAvJHOP1S21bKtwXozhpEgG110MIeccP6eomv2aYLK16YErOQ/s16000/mkdir+in+linux.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkmqA8Gbil5TPSeFE6L42XppFd-q9M_PUPmQjduYxazNQb6GOg2MjwRjMOB0TH5l_9dTcT1O2pGXCorpxz75penkYMwYVAvJHOP1S21bKtwXozhpEgG110MIeccP6eomv2aYLK16YErOQ/s72-c/mkdir+in+linux.png
Pro Tech guides
https://devops-digest.blogspot.com/2020/11/create-directory-in-linux-by-mkdir-command.html
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/2020/11/create-directory-in-linux-by-mkdir-command.html
true
7053638852026728047
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content