Less is a command-line pager: a program that shows one page out of a file in a terminal window and shows more pages one at a time upon user request, irrespective of file size. Another noted similar program is more.

Less allows moving back and forth, supports arrow keys, and, when at the end of a pipeline, shows as much of the buffer as it can from the content fed into it, refreshing its buffer regularly as the pipeline provides more of the content.

Examples:

  • less --help
    • Displays help in the less command itself. -h and -H do not output help.
  • less --version
  • less -V
    • Outputs version.
  • less -psearchterm MyFile.txt
    • Option -p opens the files at the occurrences of the searchterm.
  • grep dog AnimalData.txt | less

Keyboard commands

edit

Keyboards commands that can be used once less is started:

  • up and down arrow keys - scroll up or down
  • page up or page down - as expected
  • home - go to the top of the file
  • end - go to the bottom of the file
  • space - scroll forward
  • q - quit
  • h - help
  • / - forward regex search
  • n - next occurrence of a search match
  • N - previous occurrence of a search match
  • -i - ignore case in further searches

Links:

Versions

edit
 
An example of Less in use.

Versions of GNU less can be seen in http://ftp.gnu.org/gnu/less/.

Greenwood Software less versions can be seen in http://www.greenwoodsoftware.com/less/download.html and http://www.greenwoodsoftware.com/less/old.html.

A version of less for MS Windows is available from GnuWin32 project, as well as from Cygwin.

License

edit

Less is dual-licensed under GNU GPL V3+ and The Less License, a BSD-like license. It follows from README file from less-481.tar.gz GNU less distribution. The Less License is stated in the LICENSE file in the same distribution.

edit