In my last post I explained that the /usr/share/doc/ directory contains a LOT of information about the packages installed on your system. I noted that some of the documentation will be stored in .gz files and how to view them. It’s easy if you’re browsing with a graphical file manager, but what if you need to view the documents from the command line?
When I originally bumped into this I just assumed that I had to extract the documents with gunzip to read them. As a regular user, you don’t have write access to this location, I needed to sudo gunzip (on Ubuntu) or switch user to root and then gunzip the file (on Fedora). I always extracted to the same directory as the documentation so that I wouldn’t have to do it again next time. Being a newb I just figured, that’s how it’s done in Linux land. NOPE!
Enter zcat and zless, these programs work just like cat and less only they operate on compressed files. If you want to view the file Changelog.gz in the current directory you enter the command zless Changelog.gz. This will display the text file in your terminal window pausing so that you can read the document in pages. You could also enter zcat Changelog.gz, that would display the text file in your terminal window without pausing.
For those of you familiar with grep, you might like to know there’s a zgrep as well.
Handy stuff!
Recent Comments