Saturday, May 21, 2016

Directory listing commands in Linux



01. See a current location (print work directory)
[root@srinivaslinux~]# pwd

02. List content in the folder

[root@srinivaslinux~]# ls
[root@srinivaslinux~]# tree

03. List all content in the folder (Hidden file)

[root@srinivaslinux~]# ls -a
[root@srinivaslinux~]# tree -a
Object Color Codes

White Color – Text base files (Htmal , Java, etc….)
Dark Blue – Folders
Green – Executable binary files and executable text file (Scripts) or any files copied from windows to Linux.
Red – Compressed files (gzip, etc….)
Purple – Multimedia files (Mp3, Pictures)
Orange – Device Driver File
Light blue color – Symlinks (Short Cuts)

04. See a long list

[root@srinivaslinux~]# ls -l

05. Long list with a hidden file

[root@srinivaslinux~]# ls -la

06. Long list, with color, and hidden files and fit to screen

[root@srinivaslinux~]# ls --color -la |more

Directory browsing commands

To go to sub folders

Use the relative path of the folder
Don’t type the current location that you are in

Ex - # cd test

[root@srinivaslinux~]# cd srinivas

To go to main folders

Use full path
Always start with /

Ex - [root@srinivaslinux~]# cd /etc

        [root@srinivaslinux~]# cd /usr/share

07. One folder back

[root@srinivaslinux~]# cd ..

08. To your home folder

[root@srinivaslinux~]# cd

09. To previous location

[root@srinivaslinux~]# cd -

10. To root partitions

[root@srinivaslinux~]# cd /

No comments:

Post a Comment