Less is more: the hidden treasure of less command

Wow, I just stumbled over less‘ PDF display capability and found this blog post with even more awsome features of less:
clipped from www.cyberciti.biz

Less is more: the hidden treasure of less command
# less +53 /etc/httpd/httpd.conf
Ok let us display an error at line number 53 (no need to scroll down all 52 lines)
Search and highlight particular text:
# less "+/*VirtualHost" /etc/httpd/httpd.conf
lessfile and lesspipe are programs that can be used to modify the way the contents of a file are displayed in less. What this means is that less can automatically open up tar files, uncompress gzipped files, and even display something reasonable for graphics files.
less command supports following extensions:

  • *.arj

  • *.tar.bz2

  • *.bz

  • *.deb, *.udeb

  • *.bz2

  • *.doc

  • *.gif, *.jpeg, *.jpg, *.pcd, *.png, *.tga, *.tiff, *.tif

  • *.lha, *.lzh

  • *.iso, *.raw, *.bin

  • *.pdf

  • *.rar, *.r[0-9][0-9]

  • *.rpm

  • *.tar.gz, *.tgz, *.tar.z, *.tar.dz

  • *.gz, *.z, *.dz

  • *.tar

  • *.jar, *.war, *.xpi, *.zip

  • *.zoo
Watch a log file
Watch maillog in real time, useful to troubleshoot mail server problem
less +F /var/log/maillog
less +F /var/log/message
You can also use tail command:
tail -f /var/log/maillog

Discussion Area - Leave a Comment