Wednesday, September 3, 2014

[Quick Tips] : Linux command : To create new directory/folder

Linux command : To create new directory/folder

In this post we will learn, how to create new directory in Linux system.Directory also called as folder(In Windows System). To create a new directory in Linux system we will use the command called mkdir. By using some options with mkdir command, we can do many things.

To create a directory in Linux

Use the below given command to create single directory in current path
Syntax:

To create multiple directory in Linux

Use the below given command to create multiple directores in current path.
Syntax:

Create directory inside existing/non existing parent directory

In case you want to create a directory inside other directory, we will use -p option with mkdir command.
Even in case parent directory do not exist,if we use -p option with mkdir command.It will create a new directory tree.
Syntax:
Example In this case, we have already existing directory called DIR1 and we will create new directory inside DIR1 with name sharad1 and sharad2 .
Here , the directory tree structure will be like this DIR1/sharad1/sharad2
We will use the command

Assigning permission while creating new directory

We can assign permission while creating a new directory.For this we will use -m option with mkdir command
Syntax:
Example : We will create a directory called green with permission 400 (Read to Owner only)

No comments: