Skip to content
Jason Charney edited this page Jan 30, 2015 · 1 revision

NOTE: For the Ruby/JavaScript thing called LESS, see LESS.

less is a utility that Linux that is described simply as "The opposite of more".

General options I like to use.

When I use less it is generally on the right side of a pipe with the following for options.

| less -eFMXR
  • -e Quit at end-of-file (EOF)
  • -F Quit if one screen
  • M Make less prompt more verobsely tha more
  • X Disable sending termcap initialization and deinitialization command to the screen. Prevents wiping the screen when you leave less pressing q.
  • R Allow raw control characters, usefull if you like color output with ls or grep.

Common uses

There are plenty of uses for the less command.

cat with less

cat file.ext | less -eFMXR  # brows a file

ls with less

ls -la | less -eFMXR  # browse a folder with lots of files

More examples on [Browse directories with ls](Browse directories with ls)

tar with less

tar -tjvf something.tar.bz2 | less -eFMXR  # brows files in a package

More examples on [Download using curl and tar](Download using curl and tar)

grep with less

dpkg --list | grep -i sed | less -eFMXR   # browse filtered results

More examples on [Search files with grep](Search files with grep)

curl with less

curl -SL http://www.weather.gov/lsx | less -eFMXR  # browse the source code of a web page.

More examples on [Download using curl and tar](Download using curl and tar)

See also

  • [Search files with grep](Search files with grep)

Clone this wiki locally