How do I make directory under Linux operating systems using the command prompt or bash shell?
You need to use the mkdir command to create new folders or directories under Linux operating systems. A directory (also known as folder in MS-Windows/OS X) is nothing but a container for other directories and files.
The mkdir command has the following syntax:
You need to use the mkdir command to create new folders or directories under Linux operating systems. A directory (also known as folder in MS-Windows/OS X) is nothing but a container for other directories and files.
mkdir command Syntax
mkdir dirname
OR
mkdir dirname1 dirname2
OR
mkdir [option] dieNameHere
OR
mkdir -p dir1/dir2/dir3
OR
mkdir dirname1 dirname2
OR
mkdir [option] dieNameHere
OR
mkdir -p dir1/dir2/dir3
Examples
Open a terminal and use the mkdir command to create empty directories. The following command would create a directory called foo:
To list directories, enter:
The following command would create two directories within the current directory:
The -p option allows you to create parent directories as needed (if parent do not already exits). For example, you can create the following directory structure:
$ mkdir foo
To list directories, enter:
$ ls
$ ls -l
The following command would create two directories within the current directory:
$ mkdir tom jerry
$ ls -l
The -p option allows you to create parent directories as needed (if parent do not already exits). For example, you can create the following directory structure:
$ mkdir -p ~/public_html/images/trip
Sample mkdir demo
SEE ALSO
- See mkdir command man page for more information.
- See ls command man page for more information.
No comments:
Post a Comment