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).
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 |
That’s great, but it’s a bit of a mouthful (or keyboardful) to remember.
Try this instead (bash syntax):
export LESSOPEN="|tar --to-stdout -zxf %s" |
Now try just typing less file.tar.gz. Magic!
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.
Huawei’s AI Update: Things Are Moving Faster Than We Think
FEATURE | By Rob Enderle,
December 04, 2020
Keeping Machine Learning Algorithms Honest in the ‘Ethics-First’ Era
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 18, 2020
Key Trends in Chatbots and RPA
FEATURE | By Guest Author,
November 10, 2020
FEATURE | By Samuel Greengard,
November 05, 2020
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 02, 2020
How Intel’s Work With Autonomous Cars Could Redefine General Purpose AI
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 29, 2020
Dell Technologies World: Weaving Together Human And Machine Interaction For AI And Robotics
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 23, 2020
The Super Moderator, or How IBM Project Debater Could Save Social Media
FEATURE | By Rob Enderle,
October 16, 2020
FEATURE | By Cynthia Harvey,
October 07, 2020
ARTIFICIAL INTELLIGENCE | By Guest Author,
October 05, 2020
CIOs Discuss the Promise of AI and Data Science
FEATURE | By Guest Author,
September 25, 2020
Microsoft Is Building An AI Product That Could Predict The Future
FEATURE | By Rob Enderle,
September 25, 2020
Top 10 Machine Learning Companies 2020
FEATURE | By Cynthia Harvey,
September 22, 2020
NVIDIA and ARM: Massively Changing The AI Landscape
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
September 18, 2020
Continuous Intelligence: Expert Discussion [Video and Podcast]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 14, 2020
Artificial Intelligence: Governance and Ethics [Video]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 13, 2020
IBM Watson At The US Open: Showcasing The Power Of A Mature Enterprise-Class AI
FEATURE | By Rob Enderle,
September 11, 2020
Artificial Intelligence: Perception vs. Reality
FEATURE | By James Maguire,
September 09, 2020
Anticipating The Coming Wave Of AI Enhanced PCs
FEATURE | By Rob Enderle,
September 05, 2020
The Critical Nature Of IBM’s NLP (Natural Language Processing) Effort
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
August 14, 2020
DATAMATION DAILY NEWSLETTER
SUBSCRIBE TO OUR IT MANAGEMENT NEWSLETTER
An eWEEK Property
Copyright 2020 TechnologyAdvice All Rights Reserved.
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.
Datamation is the leading industry resource for B2B data professionals and technology buyers. Datamation's focus is on providing insight into the latest trends and innovation in AI, data security, big data, and more, along with in-depth product recommendations and comparisons. More than 1.7M users gain insight and guidance from Datamation every year.
Advertise with TechnologyAdvice on Datamation and our other data and technology-focused platforms.
Advertise with Us
Property of TechnologyAdvice.
© 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this
site are from companies from which TechnologyAdvice receives
compensation. This compensation may impact how and where products
appear on this site including, for example, the order in which
they appear. TechnologyAdvice does not include all companies
or all types of products available in the marketplace.