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 is displaying the file, various commands can be used to navigate through the file. These commands are based on those used by both and . It is also possible to search for character patterns in the file. By default, 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, behaves like . The lesspipe.sh extension can automatically determine file types such as
PDF, multimedia, and
compressed archives, and automatically determines which program to launch display the file's information with, such as text from a PDF file, metadata of photos, lists of files in a compressed archive, and content of a single file in a compressed archive. The command-
syntax is: less [options] [file_name]…
Frequently used options • -g: Highlight just the current match of any searched string. • -i: Search case-insensitively. • -m: Show more detailed prompt, including file position. • -N: Show line numbers (useful for viewing
source code). • -x3: Set tabstops (the number of columns per hard tab character) to the specified number (3, in this example) (useful for viewing
source code). • -S: Disable line wrapping ("chop long lines"). Long lines can be seen by side-scrolling. • -X: Leave file contents on screen when less exits. • -?: Show help. • --follow-name: Follow mode, for log files that get replaced while being viewed.
Frequently used commands == Examples ==