CentOS Linux Server Guide

Centos Linux Command Line Operation

Symbols and Special Character for Special Directories

 

In Linux Command Line Operation, you can combine certain  special symbols  which represent certain directories.

 
Symbols Directory

~

user's home directory

Note: when you use ~ for root, the home directory is /root. While, user's diectory is in /home/user

[root@srv1 ~]# pwd
/root

[jane@srv1 log]$ cd ~
[jane@srv1 ~]$ pwd
/home/jane
 

 

- previous directory

This is useful, when you want to previous directory you are working on.

[jane@srv1 log]$ cd /var/log/mail
[jane@srv1 mail]$ cd /home/
[jane@srv1 home]$
cd -
/var/log/mail
[jane@srv1 mail]$

 

 

. current directory.

This is useful when you want to copy files to current directory you want to work on.

[root@srv1 demo]# ls
Dir_empty myDir newmyDir
[root@srv1 demo]#
cp /var/mail/jane .
[root@srv1 demo]# ll
total 28
drwxr-xr-x 2 root root 4096 Nov 29 17:19 Dir_empty
-rw-r----- 1 root root 0 Nov 30 00:10 jane
drwxr-xr-x 2 root root 4096 Nov 28 16:00 myDir
drwxr-xr-x 2 root root 4096 Nov 28 15:43 newmyDir

 

 

.. directory which up one level

This use for when you want to go back few levels up from current directory.

[root@srv1 /]# cd /etc/sysconfig/network-scripts/
[root@srv1 network-scripts]#
cd ../../
[root@srv1 etc]# pwd
/etc

 

 

 

Back to Command Line Operation



Copyright 2011 http://www.1a-centosserver.com All Rights Reserved

All trademarks are the property of their respective owners.

Contact Us | Terms of Use | Privacy Policy