On Fedora/Redhat/CentOS the less command seems to magically detect a gzipped file and decompress it on the fly, so you can do:
less my_stuff.csv.gz
I've just noticed this doesn't work on Ubuntu 11
less my_stuff.csv.gz
"my_stuff.csv.gz" may be a binary file. See it anyway?
I've been examining my CentOS VMs to see if there's some shell alias magic that makes it work but there doesn't seem to be. Is gzip support just built in to the CentOS binary?
If anyone knows how this works on CentOS and/or how it can be made to work on Ubuntu I'd be grateful.
I'm aware I can do
zcat my_stuff.csv.gz | less
but that would make my keyboard wear out more quickly.
less myfile.txt.gzworks out-of-the-box. – Pablo Bianchi Sep 29 '17 at 01:21moarpager will transparently decompress gzip, zstd, xz and bzip2, from files or stdin: github.com/walles/moar. Disclaimer: I wrote moar so of course I like it. – Johan Walles Jan 15 '25 at 05:11