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 regularly use the 'less' command in Gentoo like so: less /tmp (or any other directory, which I have access to.)

Less then proceeds to show me the contents of that directory. I can also use Less to show the contents of files (the usual use case).

In Ubuntu (Oneiric) when executing the above command, Less reports: /tmp is a directory

Less will not list the contents of the directory.

I am using Less version 444 in both operating systems.

Can anyone help? I have been unsuccessful searching online.

Thanks in advance.

share|improve this question

Check out the README.gentoo file in


The behavior of less is customized by a script (in that same directory). If the argument passed is a directory, does ls -alF on it and that is what less pages.

See the less man page, Input preprocessor section for additional information. You can probably pick up Gentoo's and put it on your Ubuntu system without much hassle.

share|improve this answer

Lesspipe is part of the less package on Ubuntu (Precise, at least), and is probably already installed on your computer.

Put this command in a login script, for instance ~/.bash_login:

eval $(lesspipe)

Then put this content in ~/.lessfilter


# show directory as listing
if test -d "$1"; then
 /bin/ls -alF -- "$1"

 # we handled this one ourself
 exit 0

# handle by regular lesspipe
exit 1

And make this file executable:

chmod +x ~/.lessfilter

Directories should now be shown as long format listings.

share|improve this answer

You must log in to answer this question.

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