On my old SUSE distro, less would automatically decompress .gz files.

That came in very convenient when listing auto-compressed /var/log/mail*.gz files.

The current version of SUSE now archives /var/log/mail and others with xz.

I never wondered how less automatically decompressed .gz files, but I probably should have (:

So: what do I need to do, so this "magically" will work:

less /var/log/mail-20130201.xz

I regard this as a Linux question, but in case it is SUSE specific, I'm running this version of SUSE:

openSUSE 12.2 (x86_64)
VERSION = 12.2

The functionality is provided by lesspipe. Install it and put (I don't have a SUSE machine at the moment to check)

[ -x /usr/bin/lessopen.sh ] && eval /usr/bin/lessopen.sh

in your shell configuration (e.g., .bashrc)

  • Thanks. Getting it to install and work was a bit of work, see my own answer. – Jeroen Wiert Pluimers Mar 3 '13 at 21:31

Thanks Matteo for pointing me into the right direction.

Getting lesspipe to run on OpenSUSE was a bit of a journey as it is not part of the standard OpenSUSE 12.x repository. You can only get 'unstable' lesspipe packages, of which the Show home:adra / lesspipe - openSUSE Build Service seems to be maintained most frequently.

This is how to install it from there:

zypper addrepo http://download.opensuse.org/repositories/home:adra/openSUSE_Factory/home:adra.repo
zypper refresh
zypper install lesspipe

I am using the bash shell, so after performing the install, I had to add this line to my my ~/.bashrc

LESSOPEN="|lesspipe.sh %s"; export LESSOPEN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.