I always tell my students how nice is less compared to more (both are paging programs) . One feature of less I emphasize is the ability to read non-text files. For instance, you can try to read a compressed file like this one /usr/share/doc/coreutils/README.gz using more:
more /usr/share/doc/coreutils/README.gz
Now using less:
less /usr/share/doc/coreutils/README.gz
Did you see any difference? if you’re using Ubuntu, maybe you could read the file using less. If you’re using Debian maybe you couldn’t…and let’s see why.
Making less read non-text files on Debian
It turns out less can read non-text files because it uses “input preprocesors”, which basically are scripts that preprocess the file before using less. So, what’s the difference between Debian and Ubuntu’s settings?. On Ubuntu every user has two environment variables set, and on Debian they don’t (at least on testing). Those variables are:
LESSCLOSE='/usr/bin/lesspipe %s %s' LESSOPEN='| /usr/bin/lesspipe %s'
You can define them in the ~/.bashrc file, but there’s a better way to do it, just uncomment the following line in the ~/.bashrc file:
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
Next time you open a bash session you’ll have those variables set, so you’ll be able to open non-text files using less.

Planeta Linux
#1 by César Mata Moya on 16/11/2009 - 8:08 pm
Esta bueno el tip…
#2 by Luis Gallardo on 16/11/2009 - 8:47 pm
Si, sobre todo porque la mayoría de la documentación en Debian viene comprimida