Search This Blog

Thursday, May 17, 2012

CLI: 2. Navigating cmd line - ls

Tip: To open the cmd line in Linux, press ctrl + alt + T 

ls is a wonderful command because it allows the user to see what's inside of a directory (aka folder) without having to peek it with the GUI.  Here's a good way to start.
In this example...

The computer, reading the default directory (my home folder), outputted the others directories within the directory. In this case, we call my home folder a parent directory and the others that follow child directories, like saying a branch with more branches.  

ls functionality is enriched with the use of options.  Options typically require "-" sign, followed by a letter.

Some worthy ls options include...
  • -a : lists all contents and directories within the working directory.
  • -l: lists directories in a long format.
  • -S : lists directories from biggest to smallest size.
  • -t : lists contents by most to least recently modified.
So, if you wrote, 

Notice a slightly different order between the first and this example.  That's because the directories were ordered by the most to least recently modified, which means that Pictures is the last place I looked at and the Documents tab the most recent.

The commands equipped with options really organize search up well, especially when sifting through a daunting number of files.  

If this gave you the intuition to get sparked by the wonders of the CLI or you have some questions in mind, please comment or question about it on the comments section below.  


  1. This is very interesting, John. I hope to see you post more about CLI. It might just get the attention of many people out there who don't know what they want to be in the future yet.

  2. Interesting things that my mind is starting to see thanks to your posts(even so its only been a few). I hope you continue to write posts for others to learn like me. Keep it up John.

  3. For anyone interested in the CLI series, I suggest that they have a Linux system at their disposal. Reading isn't the same as trying them out.