Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Summary of _less_ comands
- ===============================================================================
- For _less_ v487, obtained through `less --help`.
- Commands marked with `[N]` may be preceded by a number, _N_.
- Notes in parentheses indicate the behavior if _N_ is given.
- A key preceded by a caret indicates the `Ctrl` key; thus `^K` is `Ctrl-K`.
- - Display this help: `h H`
- - Exit: `q :q Q :Q ZZ`
- Moving
- -------------------------------------------------------------------------------
- - Forward one line (or _N_ lines): `[N]` `e ^E j ^N CR`
- - Backward one line (or _N_ lines): `[N]` `y ^Y k ^K ^P`
- - Forward one window (or _N_ lines): `[N]` `f ^F ^V SPACE`
- - Backward one window (or _N_ lines): `[N]` `b ^B ESC-v`
- - Forward one window (and set window to _N_): `[N]` `z`
- - Backward one window (and set window to _N_): `[N]` `w`
- - Forward one window, but don't stop at end-of-file: `[N]` `ESC-SPACE`
- - Forward one half-window (and set half-window to _N_): `[N]` `d ^D`
- - Backward one half-window (and set half-window to _N_): `[N]` `u ^U`
- - Left one half screen width (or _N_ positions): `[N]` `ESC-) RightArrow`
- - Right one half screen width (or _N_ positions): `[N]` `ESC-( LeftArrow`
- - Right to last column displayed: `ESC-} ^RightArrow`
- - Left to first column: `ESC-{ ^LeftArrow`
- - Forward forever; like `tail -f`: `F`
- - Like F but stop when search pattern is found: `ESC-F`
- - Repaint screen: `r ^R ^L`
- - Repaint screen, discarding buffered input: `R`
- Default "window" is the screen height.
- Default "half-window" is half of the screen height.
- Searching
- -------------------------------------------------------------------------------
- - Search forward for (_N_-th) matching line: `[N]` `/pattern`
- - Search backward for (_N_-th) matching line: `[N]` `?pattern`
- - Repeat previous search (for _N_-th occurrence): `[N]` `n`
- - Repeat previous search in reverse direction: `[N]` `N`
- - Repeat previous search, spanning files: `[N]` `ESC-n`
- - Repeat previous search, reverse dir. & spanning files: `[N]` `ESC-N`
- - Undo (toggle) search highlighting: `ESC-u`
- - Display only matching lines: `[N]` `&pattern`
- A search pattern may be preceded by one or more of:
- - Search for NON-matching lines: `^N` or `!`
- - Search multiple files (pass thru END OF FILE): `^E` or `*`
- - Start search at FIRST file (for `/`) or last file (for `?`): `^F` or `@`
- - Highlight matches, but don't move (KEEP position): `^K`
- - Don't use REGULAR EXPRESSIONS: `^R`
- Jumping
- -------------------------------------------------------------------------------
- - Go to first line in file (or line _N_): `[N]` `g < ESC-<`
- - Go to last line in file (or line _N_): `[N]` `G > ESC->`
- - Go to beginning of file (or _N_ percent into file): `[N]` `p %`
- - Go to the (_N_-th) next tag: `[N]` `t`
- - Go to the (_N_-th) previous tag: `[N]` `T`
- - Find close bracket _} ) ]_: `[N]` `{ ( [`
- - Find open bracket _{ ( [_: `[N]` `} ) ]`
- - Find close bracket _<c2>_: `[N]` `ESC-^F <c1> <c2>`
- - Find open bracket _<c1>_: `[N]` `ESC-^B <c1> <c2>`
- Each "find close bracket" command goes forward to the close bracket matching
- the (_N_-th) open bracket in the top line.
- Each "find open bracket" command goes backward to the open bracket matching
- the (_N_-th) close bracket in the bottom line.
- - Mark the current position with _<letter>_: `[N]` `m<letter>`
- - Go to a previously marked position: `[N]` `'<letter>`
- - Go to the previous position: `[N]` `''`
- - Same as `'`: `[N]` `^X^X`
- A mark is any upper-case or lower-case letter.
- Certain marks are predefined:
- - `^` means beginning of the file
- - `$` means end of the file
- Changing files
- -------------------------------------------------------------------------------
- - Examine a new file: `[N]` `:e [file]`
- - Same as `:e`: `[N]` `^X^V`
- - Examine the (_N_-th) next file from the command line: `[N]` `:n`
- - Examine the (_N_-th) previous file from the command line: `[N]` `:p`
- - Examine the first (or _N_-th) file from the command line: `[N]` `:x`
- - Delete the current file from the command line list: `[N]` `:d`
- - Print current file name: `[N]` `= ^G :f`
- Miscellaneous commands
- -------------------------------------------------------------------------------
- - Toggle a command line option [see _Options_ below]: `[N]` `-<flag>`
- - Toggle a command line option, by name: `[N]` `--<name>`
- - Display the setting of a command line option: `[N]` `_<flag>`
- - Display the setting of an option, by name: `[N]` `__<name>`
- - Execute the less cmd each time a new file is examined: `[N]` `+cmd`
- - Execute the shell command with _$SHELL_: `[N]` `!command`
- - Pipe file between current pos and mark X to shell command: `[N]` `|Xcommand`
- - Save input to a file: `s file`
- - Edit the current file with _$VISUAL_ or _$EDITOR_: `[N]` `v`
- - Print version number of _less_: `[N]` `V`
- Options
- -------------------------------------------------------------------------------
- Most options may be changed either on the command line, or from within _less_
- by using the `-` or `--` command. Options may be given in one of two forms:
- either a single character preceded by a `-`, or a name preceded by `--`.
- - Display help (from command line): `-?`, `--help`
- - Search skips current screen: `-a`, `--search-skip-screen`
- - Search starts just after target line: `-A`, `--SEARCH-SKIP-SCREEN`
- - Number of buffers: `-b [N]`, `--buffers=[N]`
- - Don't automatically allocate buffers for pipes: `-B`, `--auto-buffers`
- - Repaint by clearing rather than scrolling: `-c`, `--clear-screen`
- - Dumb terminal: `-d`, `--dumb`
- - Set screen colors. (MS-DOS only): `-D [xn.n]`, `--color=xn.n`
- - Quit at end of file: `-e -E`, `--quit-at-eof --QUIT-AT-EOF`
- - Force open non-regular files: `-f`, `--force`
- - Quit if entire file fits on first screen: `-F`, `--quit-if-one-screen`
- - Highlight only last match for searches: `-g`, `--hilite-search`
- - Don't highlight any matches for searches: `-G`, `--HILITE-SEARCH`
- - Backward scroll limit: `-h [N]`, `--max-back-scroll=[N]`
- - Ignore case in searches that do not contain uppercase: `-i`, `--ignore-case`
- - Ignore case in all searches: `-I`, `--IGNORE-CASE`
- - Screen position of target lines: `-j [N]`,`--jump-target=[N]`
- - Display a status column at left edge of screen: `-J`, `--status-column`
- - Use a lesskey file: `-k [file]`,`--lesskey-file=[file]`
- - Exit less in response to Ctrl-C: `-K`,`--quit-on-intr`
- - Ignore the LESSOPEN environment variable: `-L`, `--no-lessopen`
- - Set prompt style: `-m -M`, `--long-prompt --LONG-PROMPT`
- - Don't use line numbers: `-n -N`, `--line-numbers --LINE-NUMBERS`
- - Copy to log file (standard input only): `-o [file]`, `--log-file=[file]`
- - Copy to log file (unconditionally overwrite): `-O [file]`, `--LOG-FILE=[file]`
- - Start at pattern (from command line): `-p [pattern]`, `--pattern=[pattern]`
- - Define new prompt: `-P [prompt]`, `--prompt=[prompt]`
- - Quiet the terminal bell: `-q -Q`, `--quiet --QUIET --silent --SILENT`
- - Output "raw" control characters: `-r -R`, `--raw-control-chars --RAW-CONTROL-CHARS`
- - Squeeze multiple blank lines: `-s`, `--squeeze-blank-lines`
- - Chop (truncate) long lines rather than wrapping: `-S`, `--chop-long-lines`
- - Find a tag: `-t [tag]`, `--tag=[tag]`
- - Use an alternate tags file: `-T [tagsfile]`, `--tag-file=[tagsfile]`
- - Change handling of backspaces: `-u -U`, `--underline-special --UNDERLINE-SPECIAL`
- - Display the version number of "less": `-V`, `--version`
- - Highlight first new line after forward-screen: `-w`, `--hilite-unread`
- - Highlight first new line after any forward movement: `-W`, `--HILITE-UNREAD`
- - Set tab stops: `-x [N[,...]]`, `--tabs=[N[,...]]`
- - Don't use termcap init/deinit strings: `-X`, `--no-init`
- - Forward scroll limit: `-y [N]`, `--max-forw-scroll=[N]`
- - Set size of window: `-z [N]`, `--window=[N]`
- - Set shell quote characters: `-" [c[c]]`, `--quotes=[c[c]]`
- - Don't display tildes after end of file: `-~`, `--tilde`
- - Horizontal scroll amount (0 = one half screen width): `-# [N]`, `--shift=[N]`
- - Don't send termcap keypad init/deinit strings: `--no-keypad`
- - The `F` command changes files if the input file is renamed: `--follow-name`
- - Subsequent options use backslash as escape char: `--use-backslash`
- Line editing
- -------------------------------------------------------------------------------
- These keys can be used to edit text being entered on the "command line" at the
- bottom of the screen.
- - Move cursor right one character: `RightArrow ESC-l`
- - Move cursor left one character: `LeftArrow ESC-h`
- - Move cursor right one word: `Ctrl-RightArrow ESC-RightArrow ESC-w `
- - Move cursor left one word: `Ctrl-LeftArrow ESC-LeftArrow ESC-b `
- - Move cursor to start of line: `HOME ESC-0`
- - Move cursor to end of line: `END ESC-$`
- - Delete char to left of cursor: `BACKSPACE`
- - Delete char under cursor: `DELETE ESC-x`
- - Delete word to left of cursor: `Ctrl-BACKSPACE ESC-BACKSPACE`
- - Delete word under cursor: `Ctrl-DELETE ESC-DELETE ESC-X`
- - Delete entire line: `Ctrl-U ESC (MS-DOS only)`
- - Retrieve previous command line: `UpArrow ESC-k`
- - Retrieve next command line: `DownArrow ESC-j`
- - Complete filename & cycle: `TAB`
- - Complete filename & reverse cycle: `SHIFT-TAB ESC-TAB`
- - Complete filename, list all: `Ctrl-L`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement