What I learnt today (WILT) – less command

This is the first blog in a new series that I have wanted to start for a while. The series will be called WILT which stands for What I Learnt Today. In our day to day life, especially at work, we all learn something or at least aspire to learn something. In this series of short blogs, I will share some interesting topics that I come across in my workplace.

The topic for today is the less command in Linux. While I have seen some of my colleagues use the less command, I have always been used to the more command. Out of curiosity, I tried out the commands and found that less is more powerful than more. Much more powerful. Here are some cool things I observed:

  1. It can load large files much easily when compared to more.
  2. All the capabilities of more are available, plus you can use VI syntax to do search and navigate
  3. Do “less <tgz file>” and less will show you the list of files inside the zip file – thanks to a colleague of mine
  4. Do “less <RPM file>” and less will show you the contents of the RPM file – the changelog and list of the all the files.
  5. On Macbook PRO both binaries point to the same thing. Even man more shows the information about less. This is a great idea from OSX team – since less is better than more.

Here is the link to the man page for less.

I am sure there are several other interesting usages of the less command. If you have something to share, leave a comment.