1 2 SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS 3 4 Commands marked with * may be preceded by a number, _N. 5 Notes in parentheses indicate the behavior if _N is given. 6 A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. 7 8 h H Display this help. 9 q :q Q :Q ZZ Exit. 10 --------------------------------------------------------------------------- 11 12 MMOOVVIINNGG 13 14 e ^E j ^N CR * Forward one line (or _N lines). 15 y ^Y k ^K ^P * Backward one line (or _N lines). 16 J * Forward one line, but don't stop at end-of-file. 17 K Y * Backward one line, but don't stop at beginning-of-file. 18 ESC-j * Forward one file line (or _N file lines). 19 ESC-k * Backward one file line (or _N file lines). 20 f ^F ^V SPACE * Forward one window (or _N lines). 21 b ^B ESC-v * Backward one window (or _N lines). 22 z * Forward one window (and set window to _N). 23 w * Backward one window (and set window to _N). 24 ESC-SPACE * Forward one window, but don't stop at end-of-file. 25 ESC-b * Backward one window, but don't stop at beginning-of-file. 26 d ^D * Forward one half-window (and set half-window to _N). 27 u ^U * Backward one half-window (and set half-window to _N). 28 ESC-) RightArrow * Right one half screen width (or _N positions). 29 ESC-( LeftArrow * Left one half screen width (or _N positions). 30 ESC-] ESC-RArrow * Right like ESC-) but stop at longest line. 31 ESC-} ^RightArrow Right to last column displayed. 32 ESC-{ ^LeftArrow Left to first column. 33 F Forward forever; like "tail -f". 34 ESC-F Like F but stop when search pattern is found. 35 ESC-f Like F but ring the bell when search pattern is found. 36 r ^R ^L Repaint screen. 37 R Repaint screen, discarding buffered input. 38 --------------------------------------------------- 39 Default "window" is the screen height. 40 Default "half-window" is half of the screen height. 41 --------------------------------------------------------------------------- 42 43 SSEEAARRCCHHIINNGG 44 45 /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. 46 ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. 47 n * Repeat previous search (for _N-th occurrence). 48 N * Repeat previous search in reverse direction. 49 ESC-n * Repeat previous search, spanning files. 50 ESC-N * Repeat previous search, reverse dir. & spanning files. 51 ^O^N ^On * Search forward for (_N-th) OSC8 hyperlink. 52 ^O^P ^Op * Search backward for (_N-th) OSC8 hyperlink. 53 ^O^L ^Ol Jump to the currently selected OSC8 hyperlink. 54 ESC-u Undo (toggle) search highlighting. 55 ESC-U Clear search highlighting. 56 &_p_a_t_t_e_r_n * Display only matching lines. 57 --------------------------------------------------- 58 Search is case-sensitive unless changed with -i or -I. 59 A search pattern may begin with one or more of: 60 ^N or ! Search for NON-matching lines. 61 ^E or * Search multiple files (pass thru END OF FILE). 62 ^F or @ Start search at FIRST file (for /) or last file (for ?). 63 ^K Highlight matches, but don't move (KEEP position). 64 ^R Don't use REGULAR EXPRESSIONS. 65 ^S _n Search for match in _n-th parenthesized subpattern. 66 ^W WRAP search if no match found. 67 ^L Enter next character literally into pattern. 68 --------------------------------------------------------------------------- 69 70 JJUUMMPPIINNGG 71 72 g < ESC-< HOME * Go to first line in file (or line _N). 73 G > ESC-> END * Go to last line in file (or line _N). 74 p % * Go to beginning of file (or _N percent into file). 75 t * Go to the (_N-th) next tag. 76 T * Go to the (_N-th) previous tag. 77 { ( [ * Find close bracket } ) ]. 78 } ) ] * Find open bracket { ( [. 79 ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. 80 ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>. 81 --------------------------------------------------- 82 Each "find close bracket" command goes forward to the close bracket 83 matching the (_N-th) open bracket in the top line. 84 Each "find open bracket" command goes backward to the open bracket 85 matching the (_N-th) close bracket in the bottom line. 86 87 m_<_l_e_t_t_e_r_> * Mark the top line (or line _N) with <letter>. 88 M_<_l_e_t_t_e_r_> * Mark the bottom line (or line _N) with <letter>. 89 '_<_l_e_t_t_e_r_> * Go to a previously marked position (put on position _N). 90 '' * Go to the previous position. 91 ^X^X * Same as '. 92 ESC-m_<_l_e_t_t_e_r_> Clear a mark. 93 --------------------------------------------------- 94 A mark is any upper-case or lower-case letter. 95 Certain marks are predefined: 96 ^ means beginning of the file 97 $ means end of the file 98 --------------------------------------------------------------------------- 99 100 CCHHAANNGGIINNGG FFIILLEESS 101 102 :e [_f_i_l_e] Examine a new file. 103 ^X^V Same as :e. 104 :n * Examine the (_N-th) next file from the command line. 105 :p * Examine the (_N-th) previous file from the command line. 106 :x * Examine the first (or _N-th) file from the command line. 107 ^O^O Open the currently selected OSC8 hyperlink. 108 :d Delete the current file from the command line list. 109 = ^G :f Print current file name. 110 --------------------------------------------------------------------------- 111 112 MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS 113 114 -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. 115 --_<_n_a_m_e_> Toggle a command line option, by name. 116 __<_f_l_a_g_> Display the setting of a command line option. 117 ___<_n_a_m_e_> Display the setting of an option, by name. 118 +_c_m_d Execute the less cmd each time a new file is examined. 119 120 !_c_o_m_m_a_n_d Execute the shell command with $SHELL. 121 #_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt. 122 |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. 123 ||XXYY_c_o_m_m_a_n_d Pipe file between mark XX and mark YY to shell command. 124 s _f_i_l_e Save input to a file. 125 v Edit the current file with $VISUAL or $EDITOR. 126 V Print version number of "less". 127 --------------------------------------------------------------------------- 128 129 OOPPTTIIOONNSS 130 131 Most options may be changed either on the command line, 132 or from within less by using the - or -- command. 133 Options may be given in one of two forms: either a single 134 character preceded by a -, or a name preceded by --. 135 136 -? ........ --help 137 Display help (from command line). 138 -a ........ --search-skip-screen 139 Search skips current screen. 140 -A ........ --SEARCH-SKIP-SCREEN 141 Search starts just after target line. 142 -b [_N] .... --buffers=[_N] 143 Number of buffers. 144 -B ........ --auto-buffers 145 Don't automatically allocate buffers for pipes. 146 -c ........ --clear-screen 147 Repaint by clearing rather than scrolling. 148 -d ........ --dumb 149 Dumb terminal. 150 -D xx_c_o_l_o_r . --color=xx_c_o_l_o_r 151 Set screen colors. 152 -e -E .... --quit-at-eof --QUIT-AT-EOF 153 Quit at end of file. 154 -f ........ --force 155 Force open non-regular files. 156 -F ........ --quit-if-one-screen 157 Quit if entire file fits on first screen. 158 -g ........ --hilite-search 159 Highlight only last match for searches. 160 -G ........ --HILITE-SEARCH 161 Don't highlight any matches for searches. 162 -h [_N] .... --max-back-scroll=[_N] 163 Backward scroll limit. 164 -i ........ --ignore-case 165 Ignore case in searches that do not contain uppercase. 166 -I ........ --IGNORE-CASE 167 Ignore case in all searches. 168 -j [_N] .... --jump-target=[_N] 169 Screen position of target lines. 170 -J ........ --status-column 171 Display a status column at left edge of screen. 172 -k _f_i_l_e ... --lesskey-file=_f_i_l_e 173 Use a compiled lesskey file. 174 -K ........ --quit-on-intr 175 Exit less in response to ctrl-C. 176 -L ........ --no-lessopen 177 Ignore the LESSOPEN environment variable. 178 -m -M .... --long-prompt --LONG-PROMPT 179 Set prompt style. 180 -n ......... --line-numbers 181 Suppress line numbers in prompts and messages. 182 -N ......... --LINE-NUMBERS 183 Display line number at start of each line. 184 -o [_f_i_l_e] .. --log-file=[_f_i_l_e] 185 Copy to log file (standard input only). 186 -O [_f_i_l_e] .. --LOG-FILE=[_f_i_l_e] 187 Copy to log file (unconditionally overwrite). 188 -p _p_a_t_t_e_r_n . --pattern=[_p_a_t_t_e_r_n] 189 Start at pattern (from command line). 190 -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] 191 Define new prompt. 192 -q -Q .... --quiet --QUIET --silent --SILENT 193 Quiet the terminal bell. 194 -r -R .... --raw-control-chars --RAW-CONTROL-CHARS 195 Output "raw" control characters. 196 -s ........ --squeeze-blank-lines 197 Squeeze multiple blank lines. 198 -S ........ --chop-long-lines 199 Chop (truncate) long lines rather than wrapping. 200 -t _t_a_g .... --tag=[_t_a_g] 201 Find a tag. 202 -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] 203 Use an alternate tags file. 204 -u -U .... --underline-special --UNDERLINE-SPECIAL 205 Change handling of backspaces, tabs and carriage returns. 206 -V ........ --version 207 Display the version number of "less". 208 -w ........ --hilite-unread 209 Highlight first new line after full screen movement. 210 -W ........ --HILITE-UNREAD 211 Highlight first new line after any movement. 212 -x [_N[,...]] --tabs=[_N[,...]] 213 Set tab stops. 214 -X ........ --no-init 215 Don't use termcap init/deinit strings. 216 -y [_N] .... --max-forw-scroll=[_N] 217 Forward scroll limit. 218 -z [_N] .... --window=[_N] 219 Set size of window. 220 -" [_c[_c]] . --quotes=[_c[_c]] 221 Set shell quote characters. 222 -~ ........ --tilde 223 Don't display tildes after end of file. 224 -# [_N] .... --shift=[_N] 225 Set horizontal scroll amount (0 = one half screen width). 226 227 --autosave=[_m_/_!_*] 228 Actions which cause the history file to be saved. 229 --emouse=[_v_s_c_r_o_l_l,_v_d_r_a_g,_h_s_c_r_o_l_l,_h_d_r_a_g,_l_c_l_i_c_k,_r_c_l_i_c_k] 230 Enable mouse features. 231 --end-prompt=[_s_t_r_i_n_g] 232 String to be printed after erasing the prompt. 233 --exit-follow-on-close 234 Exit F command on a pipe when writer closes pipe. 235 --file-size 236 Automatically determine the size of the input file. 237 --follow-name 238 The F command changes files if the input file is renamed. 239 --form-feed 240 Stop scrolling when a form feed character is reached. 241 --header=[_L[,_C[,_N]]] 242 Use _L lines (starting at line _N) and _C columns as headers. 243 --hilite-target 244 Highlight the target line. 245 --incsearch 246 Search file as each pattern character is typed in. 247 --intr=[_C] 248 Use _C instead of ^X to interrupt a read. 249 --lesskey-context=_t_e_x_t 250 Use lesskey source file contents. 251 --lesskey-src=_f_i_l_e 252 Use a lesskey source file. 253 --line-num-width=[_N] 254 Set the width of the -N line number field to _N characters. 255 --match-shift=[_N] 256 Show at least _N characters to the left of a search match. 257 --modelines=[_N] 258 Read _N lines from the input file and look for vim modelines. 259 --mouse 260 Enable mouse clicking and vertical scrolling. 261 --no-edit-warn 262 Don't warn when using v command on a file opened via LESSOPEN. 263 --no-keypad 264 Don't send termcap keypad init/deinit strings. 265 --no-histdups 266 Remove duplicates from command history. 267 --no-number-headers 268 Don't give line numbers to header lines. 269 --no-paste 270 Ignore pasted input. 271 --no-search-header-lines 272 Searches do not include header lines. 273 --no-search-header-columns 274 Searches do not include header columns. 275 --no-search-headers 276 Searches do not include header lines or columns. 277 --no-vbell 278 Disable the terminal's visual bell. 279 --redraw-on-quit 280 Redraw final screen when quitting. 281 --rscroll=[_C] 282 Set the character used to mark truncated lines. 283 --save-marks 284 Retain marks across invocations of less. 285 --search-options=[EFKNRW-] 286 Set default options for every search. 287 --show-preproc-errors 288 Display a message if preprocessor exits with an error status. 289 --past-eof 290 Scrolling commands continue past end of file. 291 --proc-backspace 292 Process backspaces for bold/underline. 293 --PROC-BACKSPACE 294 Treat backspaces as control characters. 295 --proc-return 296 Delete carriage returns before newline. 297 --PROC-RETURN 298 Treat carriage returns as control characters. 299 --proc-tab 300 Expand tabs to spaces. 301 --PROC-TAB 302 Treat tabs as control characters. 303 --status-col-width=[_N] 304 Set the width of the -J status column to _N characters. 305 --status-line 306 Highlight or color the entire line containing a mark. 307 --use-backslash 308 Subsequent options use backslash as escape char. 309 --use-color 310 Enables colored text. 311 --wheel-lines=[_N] 312 Each click of the mouse wheel moves _N lines. 313 --wordwrap 314 Wrap lines at spaces. 315 316 317 --------------------------------------------------------------------------- 318 319 LLIINNEE EEDDIITTIINNGG 320 321 These keys can be used to edit text being entered 322 on the "command line" at the bottom of the screen. 323 324 RightArrow ..................... ESC-l ... Move cursor right one character. 325 LeftArrow ...................... ESC-h ... Move cursor left one character. 326 ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word. 327 ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word. 328 HOME ........................... ESC-0 ... Move cursor to start of line. 329 END ............................ ESC-$ ... Move cursor to end of line. 330 BACKSPACE ................................ Delete char to left of cursor. 331 DELETE ......................... ESC-x ... Delete char under cursor. 332 ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor. 333 ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor. 334 ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line. 335 UpArrow ........................ ESC-k ... Retrieve previous command line. 336 DownArrow ...................... ESC-j ... Retrieve next command line. 337 TAB ...................................... Complete filename & cycle. 338 SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. 339 ctrl-L ................................... Complete filename, list all. 340