http://itmanagement.earthweb.com/osrc/article.php/3800081/The-Fast-Way-to-Read-Compressed-Files-on-Linux.htm
Back to article
The Fast Way to Read Compressed Files on LinuxBy Juliet KempFebruary 2, 2009 less, the better-featured version of more, which among other things allows you to move backward through its output, is great for paging through text files. But it won't automatically deal with compressed text files. This can be a nuisance, particularly when many of the files in /usr/share/doc are gzipped. A straightforward alternative is zless, which will deal seamlessly with gzip, compress, or pack files, allowing you to page through them without having to unzip them. It also handles uncompressed files, and (contrary to the manpage) it appears to deal OK with input piped from stdin (e.g., ls | zless).
In fact, this will deal with both uncompressed files and piped input as well, so you can set this variable in your .bashrc. However, it won't work on plain .gz files â for those, you should still use zless. One last note: If you regularly want to look at tar archives that aren't also zipped (e.g., file.tar), you can set export LESSOPEN="|tar --to-stdout -xf %s" to work the same trick for these files. This article was first published on ServerWatch.com. |