Thursday, 1 December 2016

Use of ls command

Viewing list of files

a)ls : This command is used to display current directory all files and directories in the ascending order based on ASCII values.By default files and directories display order is ascending.
                                  Syntax:$ls

b)ls -r : This command is used to display current directory all files and directories in the descending order or reverse order.
                                  Syntax:$ls -r

c)ls -R : This command is used to display current directory all files and directories recursively.
                                  Syntax:$ls -R

d)ls -a : This command is used to display current directory all files and directories including hidden files.
                                  Syntax:$ls -a

e)ls -u : This command is used to display current directory all files and directories based on when they were last used.
                                  Syntax:$ls -u

f)ls -t : This command is used to display current directory all files and directories based on date and of creation.
                                  Syntax:$ls -t

g)ls -l : This command is used to display list of all files in long list format.
                                  Syntax:$ls -l
Here
d and - represent file type.
rwrwxr-x and rw-rw-r represents file permissions
3 and 1 represents Number of links.
practice and practice represents owner name.
practice and practice represents group name.
4096,0,46,10 represents size in bytes.
Dec 1,Nov 30 represents date.
18:52,23:51 represents time.
ABC,f1,f2 are filename.

h)ls -lr : This command is used to display current directory all files and directories in the descending order or reverse order in long list format.
                                   Syntax:$ls -lr
i)ls -lR : This command is used to display current directory all files and directories recursively in long list format.
                                   Syntax:$ls -lR

j)ls -la : This command is used to display current directory all files and directories including hidden files in long list format.
                                   Syntax:$ls -la

k)ls -lu : This command is used to display current directory all files and directories based on when they were last used in long list format.
                                   Syntax:$ls -lu
l)ls -lt : This command is used to display current directory all files and directories based on date and of creation in long list format.
                                  Syntax:$ls -lt

No comments:

Post a Comment