Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I couldn't help but notice that the 'less' program on all of the recent distributions of Linux that I've used (Ubuntu and Gentoo in this case) allow me to view the contents of ZIP and TAR archives, while the install of 'less' that I have on OS X (and Solaris) instead produce a " may be a binary file. See it anyway?", which proceeds to spit out the raw binary data instead of a nice file structure listing.

Google has not produced much in the way of helpful results -- it's tricky to search for 'less' in this context. I downloaded and built the latest version from, but even it refuses to show the contents of these archives. I didn't come across any related configure/build options either. Any ideas? Thanks!

share|improve this question
I found your answer via Google, and it wasn't easy. Glad I made it though! – Adam Dec 13 '13 at 18:05
up vote 2 down vote accepted

less uses $LESSOPEN to point to a script that will preprocess the file being passed to less. In the case of a .zip file the script runs zipinfo against it, returning information about the archive. Copy the script from a Linux machine and configure your OS X machine to use it.

share|improve this answer
Configure how? Just set the $LESSOPEN variable? – Daniel Beck Jan 12 '11 at 15:54
@Daniel: And making the script executable. – Ignacio Vazquez-Abrams Jan 12 '11 at 15:56
Ah ha -- perfect! – multihead Jan 12 '11 at 16:58
The script commonly used is It's available via macports or directly from – Doug Harris Jan 12 '11 at 16:59

On Linux systems zless and zmore can show gzip compressed files (and old compress .Z files too, but you rarely see those now).

That's not exactly what you're asking though. A gzip compressed file is just a single file, compressed. A Zip file is collection of files and metadata. I'm not sure how you'd navigate the zip file with less. How do you do symlinks? How do you show the file metadata? I'm not saying it doesn't exist, but I haven't seen it, and i'm not sure what it would look like on OSX, which is even more graphical than most Linuxes.

share|improve this answer
I don't know if it came with Mavericks or I somehow installed it myself, but I have zless in /usr/bin/ on OS X 10.9.2. – Daryl Spitzer Apr 9 '14 at 14:09

In OS X I suggest to directly install lesspipe. I did it using Macports, but you're free to use your preferred method.

sudo port install lesspipe

To use lesspipe, set this in your .bash_profile:

export LESSOPEN='| /opt/local/bin/ %s'
share|improve this answer
Needs a single quote on the end. export LESSOPEN='| /opt/local/bin/ %s' – Adam Jun 3 '15 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .