The ls Command

Estimated read time 2 min read

To list the directory content, we can use command ls. For example, I’m in Home I can see all the directories in Home after I enter command ls.

when I add -a after ls, (ls -a) it will display all files included hidden files. (with a dot Infront of the file name).

If I add -l after ls, (ls -l) it will display whit more details.

Another command is ls -t, this allow user to sort the files by the most visit, start from latest one. As we can see below, last modified file was Desktop then follow by Documents and so on.

To be more detail, we can use command ls -lat. This will display all the by modification date and time, from top to bottom.

ls -lat

To know the user id UID number of a file or Directory we use the command ls-n as shown below

ls -n

Whenever you are inside a directory, you can also list the parent directory without need to type directory full name with command ls ../ as shown Below.we see the content of Pictures from AdobeLightroom Directory Pictures is the parent Directory.

By using the command ls -r, we can list directory including its sub directories.as shown Below. Try it on your own and see the magic.

I Hope you benefit and enjoyed it!. If you have any question comment it down Thank you.

Abubakar Abdurrahman https://sadeeqtech.com.ng

Young IT Expert CEO Sadeeq Technologies and a former student of Informatics Academy. Now a Web/App Developer by Profession, Penetration Tester by Passion and Linux Administrator by Interest.

You May Also Like

More From Author

1 Comment

Add yours

+ Leave a Comment