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