Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.03 KB | None | 0 0
  1. Summary of _less_ comands
  2. ===============================================================================
  3.  
  4. For _less_ v487, obtained through `less --help`.
  5.  
  6. Commands marked with `[N]` may be preceded by a number, _N_.
  7. Notes in parentheses indicate the behavior if _N_ is given.
  8.  
  9. A key preceded by a caret indicates the `Ctrl` key; thus `^K` is `Ctrl-K`.
  10.  
  11. - Display this help: `h H`
  12. - Exit: `q :q Q :Q ZZ`
  13.  
  14.  
  15.  
  16. Moving
  17. -------------------------------------------------------------------------------
  18.  
  19. - Forward one line (or _N_ lines): `[N]` `e ^E j ^N CR`
  20. - Backward one line (or _N_ lines): `[N]` `y ^Y k ^K ^P`
  21. - Forward one window (or _N_ lines): `[N]` `f ^F ^V SPACE`
  22. - Backward one window (or _N_ lines): `[N]` `b ^B ESC-v`
  23. - Forward one window (and set window to _N_): `[N]` `z`
  24. - Backward one window (and set window to _N_): `[N]` `w`
  25. - Forward one window, but don't stop at end-of-file: `[N]` `ESC-SPACE`
  26. - Forward one half-window (and set half-window to _N_): `[N]` `d ^D`
  27. - Backward one half-window (and set half-window to _N_): `[N]` `u ^U`
  28. - Left one half screen width (or _N_ positions): `[N]` `ESC-) RightArrow`
  29. - Right one half screen width (or _N_ positions): `[N]` `ESC-( LeftArrow`
  30. - Right to last column displayed: `ESC-} ^RightArrow`
  31. - Left to first column: `ESC-{ ^LeftArrow`
  32. - Forward forever; like `tail -f`: `F`
  33. - Like F but stop when search pattern is found: `ESC-F`
  34. - Repaint screen: `r ^R ^L`
  35. - Repaint screen, discarding buffered input: `R`
  36.  
  37. Default "window" is the screen height.
  38. Default "half-window" is half of the screen height.
  39.  
  40.  
  41.  
  42. Searching
  43. -------------------------------------------------------------------------------
  44.  
  45. - Search forward for (_N_-th) matching line: `[N]` `/pattern`
  46. - Search backward for (_N_-th) matching line: `[N]` `?pattern`
  47. - Repeat previous search (for _N_-th occurrence): `[N]` `n`
  48. - Repeat previous search in reverse direction: `[N]` `N`
  49. - Repeat previous search, spanning files: `[N]` `ESC-n`
  50. - Repeat previous search, reverse dir. & spanning files: `[N]` `ESC-N`
  51. - Undo (toggle) search highlighting: `ESC-u`
  52. - Display only matching lines: `[N]` `&pattern`
  53.  
  54. A search pattern may be preceded by one or more of:
  55. - Search for NON-matching lines: `^N` or `!`
  56. - Search multiple files (pass thru END OF FILE): `^E` or `*`
  57. - Start search at FIRST file (for `/`) or last file (for `?`): `^F` or `@`
  58. - Highlight matches, but don't move (KEEP position): `^K`
  59. - Don't use REGULAR EXPRESSIONS: `^R`
  60.  
  61.  
  62.  
  63. Jumping
  64. -------------------------------------------------------------------------------
  65.  
  66. - Go to first line in file (or line _N_): `[N]` `g < ESC-<`
  67. - Go to last line in file (or line _N_): `[N]` `G > ESC->`
  68. - Go to beginning of file (or _N_ percent into file): `[N]` `p %`
  69. - Go to the (_N_-th) next tag: `[N]` `t`
  70. - Go to the (_N_-th) previous tag: `[N]` `T`
  71. - Find close bracket _} ) ]_: `[N]` `{ ( [`
  72. - Find open bracket _{ ( [_: `[N]` `} ) ]`
  73. - Find close bracket _<c2>_: `[N]` `ESC-^F <c1> <c2>`
  74. - Find open bracket _<c1>_: `[N]` `ESC-^B <c1> <c2>`
  75.  
  76. Each "find close bracket" command goes forward to the close bracket matching
  77. the (_N_-th) open bracket in the top line.
  78. Each "find open bracket" command goes backward to the open bracket matching
  79. the (_N_-th) close bracket in the bottom line.
  80.  
  81. - Mark the current position with _<letter>_: `[N]` `m<letter>`
  82. - Go to a previously marked position: `[N]` `'<letter>`
  83. - Go to the previous position: `[N]` `''`
  84. - Same as `'`: `[N]` `^X^X`
  85.  
  86. A mark is any upper-case or lower-case letter.
  87. Certain marks are predefined:
  88.  
  89. - `^` means beginning of the file
  90. - `$` means end of the file
  91.  
  92.  
  93.  
  94. Changing files
  95. -------------------------------------------------------------------------------
  96.  
  97. - Examine a new file: `[N]` `:e [file]`
  98. - Same as `:e`: `[N]` `^X^V`
  99. - Examine the (_N_-th) next file from the command line: `[N]` `:n`
  100. - Examine the (_N_-th) previous file from the command line: `[N]` `:p`
  101. - Examine the first (or _N_-th) file from the command line: `[N]` `:x`
  102. - Delete the current file from the command line list: `[N]` `:d`
  103. - Print current file name: `[N]` `= ^G :f`
  104.  
  105.  
  106.  
  107. Miscellaneous commands
  108. -------------------------------------------------------------------------------
  109.  
  110. - Toggle a command line option [see _Options_ below]: `[N]` `-<flag>`
  111. - Toggle a command line option, by name: `[N]` `--<name>`
  112. - Display the setting of a command line option: `[N]` `_<flag>`
  113. - Display the setting of an option, by name: `[N]` `__<name>`
  114. - Execute the less cmd each time a new file is examined: `[N]` `+cmd`
  115. - Execute the shell command with _$SHELL_: `[N]` `!command`
  116. - Pipe file between current pos and mark X to shell command: `[N]` `|Xcommand`
  117. - Save input to a file: `s file`
  118. - Edit the current file with _$VISUAL_ or _$EDITOR_: `[N]` `v`
  119. - Print version number of _less_: `[N]` `V`
  120.  
  121.  
  122.  
  123. Options
  124. -------------------------------------------------------------------------------
  125.  
  126. Most options may be changed either on the command line, or from within _less_
  127. by using the `-` or `--` command. Options may be given in one of two forms:
  128. either a single character preceded by a `-`, or a name preceded by `--`.
  129.  
  130. - Display help (from command line): `-?`, `--help`
  131. - Search skips current screen: `-a`, `--search-skip-screen`
  132. - Search starts just after target line: `-A`, `--SEARCH-SKIP-SCREEN`
  133. - Number of buffers: `-b [N]`, `--buffers=[N]`
  134. - Don't automatically allocate buffers for pipes: `-B`, `--auto-buffers`
  135. - Repaint by clearing rather than scrolling: `-c`, `--clear-screen`
  136. - Dumb terminal: `-d`, `--dumb`
  137. - Set screen colors. (MS-DOS only): `-D [xn.n]`, `--color=xn.n`
  138. - Quit at end of file: `-e -E`, `--quit-at-eof --QUIT-AT-EOF`
  139. - Force open non-regular files: `-f`, `--force`
  140. - Quit if entire file fits on first screen: `-F`, `--quit-if-one-screen`
  141. - Highlight only last match for searches: `-g`, `--hilite-search`
  142. - Don't highlight any matches for searches: `-G`, `--HILITE-SEARCH`
  143. - Backward scroll limit: `-h [N]`, `--max-back-scroll=[N]`
  144. - Ignore case in searches that do not contain uppercase: `-i`, `--ignore-case`
  145. - Ignore case in all searches: `-I`, `--IGNORE-CASE`
  146. - Screen position of target lines: `-j [N]`,`--jump-target=[N]`
  147. - Display a status column at left edge of screen: `-J`, `--status-column`
  148. - Use a lesskey file: `-k [file]`,`--lesskey-file=[file]`
  149. - Exit less in response to Ctrl-C: `-K`,`--quit-on-intr`
  150. - Ignore the LESSOPEN environment variable: `-L`, `--no-lessopen`
  151. - Set prompt style: `-m -M`, `--long-prompt --LONG-PROMPT`
  152. - Don't use line numbers: `-n -N`, `--line-numbers --LINE-NUMBERS`
  153. - Copy to log file (standard input only): `-o [file]`, `--log-file=[file]`
  154. - Copy to log file (unconditionally overwrite): `-O [file]`, `--LOG-FILE=[file]`
  155. - Start at pattern (from command line): `-p [pattern]`, `--pattern=[pattern]`
  156. - Define new prompt: `-P [prompt]`, `--prompt=[prompt]`
  157. - Quiet the terminal bell: `-q -Q`, `--quiet --QUIET --silent --SILENT`
  158. - Output "raw" control characters: `-r -R`, `--raw-control-chars --RAW-CONTROL-CHARS`
  159. - Squeeze multiple blank lines: `-s`, `--squeeze-blank-lines`
  160. - Chop (truncate) long lines rather than wrapping: `-S`, `--chop-long-lines`
  161. - Find a tag: `-t [tag]`, `--tag=[tag]`
  162. - Use an alternate tags file: `-T [tagsfile]`, `--tag-file=[tagsfile]`
  163. - Change handling of backspaces: `-u -U`, `--underline-special --UNDERLINE-SPECIAL`
  164. - Display the version number of "less": `-V`, `--version`
  165. - Highlight first new line after forward-screen: `-w`, `--hilite-unread`
  166. - Highlight first new line after any forward movement: `-W`, `--HILITE-UNREAD`
  167. - Set tab stops: `-x [N[,...]]`, `--tabs=[N[,...]]`
  168. - Don't use termcap init/deinit strings: `-X`, `--no-init`
  169. - Forward scroll limit: `-y [N]`, `--max-forw-scroll=[N]`
  170. - Set size of window: `-z [N]`, `--window=[N]`
  171. - Set shell quote characters: `-" [c[c]]`, `--quotes=[c[c]]`
  172. - Don't display tildes after end of file: `-~`, `--tilde`
  173. - Horizontal scroll amount (0 = one half screen width): `-# [N]`, `--shift=[N]`
  174. - Don't send termcap keypad init/deinit strings: `--no-keypad`
  175. - The `F` command changes files if the input file is renamed: `--follow-name`
  176. - Subsequent options use backslash as escape char: `--use-backslash`
  177.  
  178.  
  179.  
  180. Line editing
  181. -------------------------------------------------------------------------------
  182.  
  183. These keys can be used to edit text being entered on the "command line" at the
  184. bottom of the screen.
  185.  
  186. - Move cursor right one character: `RightArrow ESC-l`
  187. - Move cursor left one character: `LeftArrow ESC-h`
  188. - Move cursor right one word: `Ctrl-RightArrow ESC-RightArrow ESC-w `
  189. - Move cursor left one word: `Ctrl-LeftArrow ESC-LeftArrow ESC-b `
  190. - Move cursor to start of line: `HOME ESC-0`
  191. - Move cursor to end of line: `END ESC-$`
  192. - Delete char to left of cursor: `BACKSPACE`
  193. - Delete char under cursor: `DELETE ESC-x`
  194. - Delete word to left of cursor: `Ctrl-BACKSPACE ESC-BACKSPACE`
  195. - Delete word under cursor: `Ctrl-DELETE ESC-DELETE ESC-X`
  196. - Delete entire line: `Ctrl-U ESC (MS-DOS only)`
  197. - Retrieve previous command line: `UpArrow ESC-k`
  198. - Retrieve next command line: `DownArrow ESC-j`
  199. - Complete filename & cycle: `TAB`
  200. - Complete filename & reverse cycle: `SHIFT-TAB ESC-TAB`
  201. - Complete filename, list all: `Ctrl-L`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement