Thursday, April 26, 2012

Linux: Howto Make a Directory Command

How do I make directory under Linux operating systems using the command prompt (bash shell)?

You need to use the mkdir command to create new folders or directories under Linux operating systems.

mkdir command Syntax

mkdir command has the following syntax:
 
mkdir dirname
mkdir dirname1 dirname2
mkdir -p dir1/dir2/dir3
 

Examples

The following command would create a directory called foo:
$ 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

No comments:

Post a Comment