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