Freebsd – Show tar file contents with ‘less’ on FreeBSD

freebsd

Constantly switching between Linux and FreeBSD I keep bumping into this. When I do:

 less something.tgz

Linux systems(well… Ubuntu to be precise) show me a list of files, which is what I generally want, while FreeBSD shows a binary contents.
How is this behavior(showing file contents) is accomplished on linux and is it possible to replicate it on FreeBSD systems?

Best Answer

Have a look at the man page of lesspipe (or lessopen) on an Ubuntu box.

With the Debian/Ubuntu version, all you have to do is to add

eval "$(lesspipe)"

to your .bashrc.

On FreeBSD you find the lesspipe.sh script in a separate port named lesspipe, which uses a version from sourceforge (that doesn't have the convenient setup above, though -- the man page of less has more info).

Here is a different version of the script I found on freshmeat: lesspipe, an addon for the browser less

Related Topic