mkdir Command in Linux

In this blog we will learn about mkdir command .We can use mkdir command to create directories in Linux .First of all lets open our terminal , We can press ctrl+alt+ t to do this .

1.Say We want to create a directory called image so we can just give mkdir command to create any directory and then thename of the directory . Command : mkdir directoryname .

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

3.Now , if we want to create a directory and a subdirectory , where directory doesnot exist , we can use -p for that . The command looks like: mkdir -p directory_name/subdirectory_name .Here directory already doesnot exist .

The another form of above command is : mkdir –parents directory/subdirectory

we can create multiple subdirectories also . We just need to list those subdirectories inside curly braces . Command : mkdir -p directory_name/{subdirectory1,subdirectory2}

This is all about mkdir command .

Partner Sites

Be the first to comment

Leave a Reply

Your email address will not be published.