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