Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.
Configure keybindings for the less command using a configuration file. The input file defaults to ~/.lesskey and the output file to ~/.less unless you specify otherwise.
Configuration file format
The configuration file for lesskey has one to three sections. These are marked by a line containing a # symbol and the name of the section: #command, #line-edit, and #env.
The #command section
The command section determines the keys used for actions within less. Each line should contain the key or key combination you wish to define, a space or tab, and the name of the action to perform. You may also add an extra string at the end, which will be performed at the end of the first action.
Keys you define should be entered as you plan to type them, with the following exceptions:
The line editing section lets you choose keys for the line-editing capabilities of less in a similar manner to the #command section, although without the "extra" string after the command. The line editing actions that can be defined are:
The third section, like the second, is optional, and you can use it to override environment variables that affect less. Each line consists of a variable, the equals sign (=), and the value to which you wish to set the variable. The most important ones are LESS, which allows you to select additional flags to pass to less when you run it, and LESSCHARSET, which lets you choose a character set. See the less manpage for a complete list of environment variables that affect the program.