less is a pager for displaying text files.
USE flags for sys-apps/less Excellent text file viewer
less is part of the @system set, so is installed by default.
emerge --ask sys-apps/less
less is configured via various environment variables and files. For detailed information, refer to theman page.
|Command-line options to pass to every invocation of less.
|Path to the file in which store a history of commands issued while using less. By default, this file will be one of $XDG_STATE_HOME/lesshst, $HOME/.local/state/lesshst, $XDG_DATA_HOME/lesshst or $HOME/.lesshst.
|Path to a file containing custom keybinding definitions, as described in theman page.
To view line n of the input, provide an argument of
less +40 file.txt
There are many bindings available for movement within less; refer to theman page for details. Some basic keybindings:
- To move line-by-line, use the vi keys (j to move down, k to move up) or the arrow keys.
- To move down a page, use Space.
- To jump to the beginning, use g; to jump to the end, use G.
To search for text within less, type
/text, followed by Enter. For example, to search for the text "less", type
/less Enter; if the text is found after the current position of the cursor, it will be highlighted. To search for the next match, type n. To clear highlighting of matches, type ESCu. Note that search is case-sensitive by default; this can be changed by passing the
--IGNORE-CASE option to the less command.
To access a summary of less commands, type h.
To exit less, type q.
By default, input to less is piped through
--no-lessopen option to the less command. Alternatively, a different preprocessor can be specified via the LESSOPEN environment variable.
- The man page