Less (Unix)

Less (Unix)

Infobox Software
name = Less



caption = Less output in a x-terminal
developer = Mark Nudelman
latest_release_version = 418
latest_release_date = 2 January 2008
operating_system = Cross-platform
genre = system utility
license = dual: either GPL or BSD-like License
website = [http://www.greenwoodsoftware.com/less/ www.greenwoodsoftware.com/less/]

less is a terminal pager program on Unix, Windows and Unix-like systems used to view (but not change) the contents of a text file one screen at a time. It is similar to more, but has the extended capability of allowing both forward and backward navigation through the file. Unlike most Unix text editors/viewers, less does not need to read the entire file before starting, resulting in faster load times with large files.

History

less was initially written by Mark Nudelman during 1983-85, in the need of a version of more able to do backward scrolling of the displayed text. The name came from the joke of doing "backwards more".less is now part of the GNU project and it is included in most Unix systems.

Usage

less can be invoked with options to change its behaviour, for example, the number of lines to display on the screen. A few options vary depending on the operating system. While less is displaying the file, various commands can be used to navigate through the file. These commands are based on those used by both more and vi. It is also possible to search for character patterns in the file.

By default, less displays the contents of the file to the standard output (one screen at a time). If the file name argument is omitted, it displays the contents from standard input (usually the output of another command through a pipe). If the output is redirected to anything other than a terminal, for example a pipe to another command, less behaves like cat.

The command-syntax is:

less " [options] " "file_name"

Frequently used options

*-g: Highlights just the current match of any searched string.
*-I: Case-insensitive searches.
*-M: Shows more detailed prompt, including file position.
*-N: Shows line numbers (useful for source code viewing).
*-S: Disables line wrap ("chop long lines"). Long lines can be seen by side scrolling.
*-?: Shows help.

Frequently used commands

* [Arrows] / [Page Up] / [Page Down] / [Home] / [End] : Navigation.
* [Space bar] : Next page.
*b: Previous page.
*"n"g: Jump to line number "n". Default is the start of the file.
*"n"G: Jump to line number "n". Default is the end of the file.
*/"pattern": Search for "pattern". Regular expressions can be used.
*n: Go to next match (after a successful search).
*N: Go to previous match.
*m"letter": Mark the current position with "letter".
*'"letter": Return to position "letter". [' = single quote]
*'^ or g: Go to start of file.
*'$ or G: Go to end of file.
*s: Save current content (got from another program like grep) in a file.
*=: File information.
*F: continually read information from file and follow its end. Useful for logs watching. Use Ctrl+C to exit this mode.
*-"option": Toggle command-line option -"option".
*h: Help.
*q: Quit.

Examples

less -M readme.txt #Read "readme.txt".

file * | less #Easier file analysis.

grep -i void *.c | less -I -p void #Case insensitive search for "void" in all .c files

External links

* [http://www.greenwoodsoftware.com/less/ Official home page]
* [http://www.linuxmanpages.com/man1/less.1.php manpage for less]

Variations of less

* [http://aqualess.sourceforge.net/ AquaLess] for Mac OS X


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Less (Unix) — less less est une commande Unix permettant de visualiser un fichier texte page par page (sans le modifier). Sa fonction est similaire à la commande more, mais permet en plus de revenir en arrière ou de rechercher une chaîne. Contrairement à vi… …   Wikipédia en Français

  • Less — can refer to: * Less (band), a band from the San Francisco bay area * less (Unix), a Unix utility used to view (but not change) the contents of a text file one screen at a time * less , a suffix See also Loess …   Wikipedia

  • less — Fichier log de la commnande emerge de gentoo affiché par less dans un terminal xfce …   Wikipédia en Français

  • Less — est une commande Unix permettant de visualiser un fichier texte page par page (sans le modifier). Sa fonction est similaire à la commande more, mais permet en plus de revenir en arrière ou de rechercher une chaîne. Contrairement à vi (qui permet… …   Wikipédia en Français

  • Less — Less, X Terminal Basisdaten Entwickler: Mark Nudelman Aktuelle Version: 429 (11. April 2009) …   Deutsch Wikipedia

  • Unix — (officially trademarked as UNIX, sometimes also written as Unix with small caps) is a computer operating system originally developed in 1969 by a group of AT T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Douglas McIlroy, and… …   Wikipedia

  • Less — Вывод less в X Терминал Тип Системная утилита Разработчик Mark Nudelman ОС …   Википедия

  • Unix time — Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1 1970, not counting leap seconds. It is widely used not only on Unix like… …   Wikipedia

  • UNIX-Kommandos — Unix Systeme zeichnen sich durch eine Vielzahl von Kommandos aus, mit denen sich über eine Shell das Betriebssystem bedienen lässt. Die Syntax dieser Kommandos weicht unter den verschiedenen Systemen voneinander ab. Es existieren die beiden… …   Deutsch Wikipedia

  • Unix-Befehle — Unix Systeme zeichnen sich durch eine Vielzahl von Kommandos aus, mit denen sich über eine Shell das Betriebssystem bedienen lässt. Die Syntax dieser Kommandos weicht unter den verschiedenen Systemen voneinander ab. Es existieren die beiden… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”