© Jonny 2013 with help from Jekyll Bootstrap
I use ls way to many times to count (2215 times in my 10k line ~/.histfile). And while I use this amazing application daily, I didn’t know the power lying in the depths of ls. A short visit to the manfile showed me the beautiful side behind ls. The little things that matter, but didn’t use because it was faster to whip up a quick awk script instead of reading the manpage.
– First things first, lets show the side of ls that most of us use most:
I would say that ls and ls -la are the most commonly used variations of ls. One shows a simple directory structure, while the other shows executable permissions, ownership, filesize, modification date; all the necessary useful bits that you need to see.
Lets start with some visuals. If you didn’t notice, my listings are in color (I have ls –color as an alias to ls). But say I wanted to have directories stand out a little more, or symlinks:
According to the manpage there are many indicators
(one of */=>@|), yet I’m unsure what the other indicators are? If I knew I would have included a few more examples.
Other than displaying little symbols to specify what the file is, there are a couple formatting options:
I hope that something new sprouted into your brain pertaining to ls. It seems that the program was written and rewritten to provide a full featured directory listing utility without the need to break out any stream editors like sed or awk. In fact a lot of the simple flags that encompass what is ls I would emulate with piping commands together just because I didn’t think that ls had useful options. Well now I know the power of ls, and learned that I should check out the flags pertaining to even the simplest of programs to find gems of programming prowess.