ls
ls command can be used to show the names of directories and files. This utility is used to know the files and subdirectories which exist inside the directories. Various options can be used with the ls command to list the contents in various formats.
Syntax
ls [options]
The following options can be used along with ls command
-a Lists all files, involving the hidden file
-C,-x Multi-column output with files sorted down in the column wise
-F Puts a slash (/) sign after every filename if the file is a directory, an asterisk (*) if the file is an executable, and an at-sign (@) if the file is a symbolic link.
-i Prints the i-node number i n the first column of the report for each file.
-l Lists in long format, giving mode, ACL denotes, number of links, owner, group, size in bytes and time of last modification for each file etc.
-R subdirectories encountered by Recursively lists.
-t Sorts through time stamp (latest first) alternatively of by name. The default is the final modification time.
Practice 1
The subsequent example shows the usage of the ls command.
# pwd
/usr/sunil
# ls
example1 example2 example3 files typescript
example4 example5 example6 login
example7 example8 example9 personal
Within the given example all the which exist inside the /usr/sunil directory have been listed.
Note: Is command lists files is an alphabetical order.