Creating and Managing Directories

To create a directory, we need to use the mkdir command.

mkdir –   make directory
syntax

mkdir <dirname>
Example 1 :  mkdir dir1
Example 2:  mkdir dir1/dir2
Example 3:  mkdir dir1/dir2/dir3

We can also  Use -P Option To Create Dir Inside A Dir (Subdirs)

Example  4:  mkdir -p india/ap/hyd/galaxy

To Change The Directory, we have to use the cd command

cd –  change directory
Syntax :

cd < dir name >

Example : 1

[root@sys10~]# cd /var/log
[root@sys10 log]# pwd
[root@sys10~]#  /var/log
[root@sys10 log]# cd /root
[root@sys10~]# pwd
[root@sys10~]#  /root

a. cd – means switch directory to previous directory
b. cd ~ means go back to home directory of user
c. cd .. means go to parent directory
d. cd ../.. means go to 2 level parent directory
e. cd means go back to home directory of user

Author: Khaja Ehteshamuddin

I am a Linux admin who believes in Hard work, Likes to share knowledge with others. At present I work as Sr. System Administrator at Hyderabad

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s