- 1 Vapor IO Brings OpenDCRE to General Availability
- 2 VMware Takes the Wraps Off vRealize Automation and vRealize Business
- 3 Microsoft Previews Hyper-V Containers for Windows Server 2016
- 4 Mirantis Led FUEL Project Gets Installed Under OpenStack Big Tent
- 5 Red Hat Enterprise Linux 7.2 Adds Security, DR Features
Reading Compressed Files With less
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).
zless can't, however, handle files that have been tarred as well as zipped. Here's an alternative command line that will allow you to page through file.tar.gz without unpacking it beforehand and thus without leaving unzipped files lying around:
tar --to-stdout -zxf file.tar.gz | less
export LESSOPEN="|tar --to-stdout -zxf %s"
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.