TOOL » LINUX » PACKAGE

Less

Usage

shell
less OPTIONS FILE
OptionDescription
+Automatically run commands
-FQuit if one screen
-ISearch ignoring case even if pattern has uppercase
-JDisplays a status column at the left edge of the screen
-NShow line numbers
-RShow colors
-SChop long lines
-XDo not clean the screen
-iSearch ignoring case if pattern is only lowercase
-nSupress line numbers

It is also possible to toggle any option by typing - and its character. For example, to show line numbers: -N.

Searching

Jump to line with a match:

  • Use / or ? to search (! to invert selection)
  • Then n or N to jump between matches
  • ESC+U to clear

Show only lines with a match:

  • Use & to search (! to invert selection)
  • &+ENTER to clear

Commands

CommandDescription
gGo to first line.
GGo to last line.
FFollow mode, ctrl+C to cancel.
mFollowed by any lowercase or uppercase letter, marks the first displayed line with that letter.
s FILENAMESave the input to a file.
| <m> CMD<m> represents any mark letter (^ start; $ end; . current). Pipes a section of the input file to the given shell command.
:nExamine the next file in the command line list.
:pExamine the previous file in the command line list.

Examples:

To copy the current screen to the clipboard, press |, then . and any of the following:

shell
wl-copy
xclip -sel clip