[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Less and .gz files



Sebastiaan <S.Breedveld@ITS.TUDelft.NL> writes:
> On Tue, 19 Feb 2002, Raffaele Sandrini wrote:
>> On my earlier SuSE system "less" was able to read gzipped text
>> files. Can i get less to do it also on Debian?
> yes, but the command is 'zless'. I beleive that the package gzip provides
> these commands. You will get a lot of other 'z' commands too, like zcat,
> zdiff, zgrep, zmore, zetc...

Not necessarily. I say just 'less' even when I want to less gzipped or
bz2'd files.

Trick is to use lesspipe. From my ~/.bash_profile:

LESS="-M-Q"
LESSOPEN="| lesspipe %s"
LESSCHARSET=latin1
PAGER=less

export LESS LESSOPEN LESSCHARSET PAGER

lesspipe is a shell-script that checks the extension on a filename and
decides how files should be viewed. To .gz-files it does does a simple
'gzip -dc', for tar's it uses 'tar tvf', for .docs 'catdoc',
picture-files such as .jpeg or .gif it says 'identify' and so one.

lesspipe comes with less.

Suonpää...



Reply to: