📄 less.man
字号:
LESS(1) LESS(1) -- Followed by one of the command line option letters (see below), this will reset the option to the "opposite" of its default setting and print a mes- sage describing the new setting. (The "--_X" com- mand does the same thing as "-_X" on the command line.) This does not work for numeric or string- valued options. _ (Underscore.) Followed by one of the command line option letters (see below), this will print a mes- sage describing the current setting of that option. The setting of the option is not changed. +cmd Causes the specified cmd to be executed each time a new file is examined. For example, +G causes _l_e_s_s to initially display each file starting at the end rather than the beginning. V Prints the version number of _l_e_s_s being run. q or :q or :Q or ZZ or ESC ESC Exits _l_e_s_s_. The following three commands may or may not be valid, depending on your particular installation. v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable EDITOR, or defaults to "vi". See also the discussion of LESSEDIT under the section on PROMPTS below. ! shell-command Invokes a shell to run the shell-command given. A percent sign (%) in the command is replaced by the name of the current file. A pound sign (#) is replaced by the name of the previously examined file. "!!" repeats the last shell command. "!" with no shell command simply invokes a shell. In all cases, the shell is taken from the environment variable SHELL, or defaults to "sh". | <m> shell-command <m> represents any mark letter. Pipes a section of the input file to the given shell command. The section of the file to be piped is between the first line on the current screen and the position 7LESS(1) LESS(1) marked by the letter. <m> may also be ^ or $ to indicate beginning or end of file respectively. If <m> is . or newline, the current screen is piped.OOPPTTIIOONNSS Command line options are described below. Most options may be changed while _l_e_s_s is running, via the "-" command. Options are also taken from the environment variable "LESS". For example, to avoid typing "less -options ..." each time _l_e_s_s is invoked, you might tell _c_s_h_: setenv LESS "-options" or if you use _s_h_: LESS="-options"; export LESS The environment variable is parsed before the command line, so command line options override the LESS environ- ment variable. If an option appears in the LESS variable, it can be reset to its default on the command line by beginning the command line option with "-+". A dollar sign ($) may be used to signal the end of an option string. This is important only for options like -P which take a following string. -? This option displays a summary of the commands accepted by _l_e_s_s (the same as the h command). If this option is given, all other options are ignored, and _l_e_s_s exits after the help screen is viewed. (Depending on how your shell interprets the question mark, it may be necessary to quote the question mark, thus: "-\?".) -a Causes searches to start after the last line dis- played on the screen, thus skipping all lines dis- played on the screen. By default, searches start at the second line on the screen (or after the last found line; see the -j option). -b_n Causes _l_e_s_s to use a non-standard number of buffers. Buffers are 1K, and by default 10 buffers are used (except if data in coming from standard input; see the -B option). The number _n specifies a different number of buffers to use. -B Disables automatic allocation of buffers, so that only the default number of buffers are used. If more data is read than will fit in the buffers, the oldest data is discarded. By default, when data is coming from standard input, buffers are allocated 8LESS(1) LESS(1) automatically as needed to avoid loss of data. -c Causes full screen repaints to be painted from the top line down. By default, full screen repaints are done by scrolling from the bottom of the screen. -C The -C option is like -c, but the screen is cleared before it is repainted. -d The -d option suppresses the error message normally displayed if the terminal is dumb; that is, lacks some important capability, such as the ability to clear the screen or scroll backward. The -d option does not otherwise change the behavior of _l_e_s_s on a dumb terminal). -e Causes _l_e_s_s to automatically exit the second time it reaches end-of-file. By default, the only way to exit _l_e_s_s is via the "q" command. -E Causes _l_e_s_s to automatically exit the first time it reaches end-of-file. -f Forces non-regular files to be opened. (A non- regular file is a directory or a device special file.) Also suppresses the warning message when a binary file is opened. By default, _l_e_s_s will refuse to open non-regular files. -h_n Specifies a maximum number of lines to scroll back- ward. If it is necessary to scroll backward more than _n lines, the screen is repainted in a forward direction instead. (If the terminal does not have the ability to scroll backward, -h0 is implied.) -i Causes searches to ignore case; that is, uppercase and lowercase are considered identical. Also, text which is overstruck or underlined can be searched for. This option is ignored if any uppercase let- ters appear in the search pattern. -j_n Specifies a line on the screen where "target" lines are to be positioned. Target lines are the object of text searches, tag searches, jumps to a line number, jumps to a file percentage, and jumps to a marked position. The screen line is specified by a number: the top line on the screen is 1, the next is 2, and so on. The number may be negative to specify a line relative to the bottom of the screen: the bottom line on the screen is -1, the second to the bottom is -2, and so on. If the -j option is used, searches begin at the line immedi- ately after the target line. For example, if "-j4" 9LESS(1) LESS(1) is used, the target line is the fourth line on the screen, so searches begin at the fifth line on the screen. -k_f_i_l_e_n_a_m_e Causes _l_e_s_s to open and interpret the named file as a _l_e_s_s_k_e_y (1) file. Multiple -k options may be specified. If a file called .less exists in the user's home directory, this file is also used as a _l_e_s_s_k_e_y file. -m Causes _l_e_s_s to prompt verbosely (like _m_o_r_e), with the percent into the file. By default, _l_e_s_s prompts with a colon. -M Causes _l_e_s_s to prompt even more verbosely than _m_o_r_e_. -n Suppresses line numbers. The default (to use line numbers) may cause _l_e_s_s to run more slowly in some cases, especially with a very large input file. Suppressing line numbers with the -n flag will avoid this problem. Using line numbers means: the line number will be displayed in the verbose prompt and in the = command, and the v command will pass the current line number to the editor (see also the discussion of LESSEDIT in PROMPTS below). -N Causes a line number to be displayed at the begin- ning of each line in the display. -o_f_i_l_e_n_a_m_e Causes _l_e_s_s to copy its input to the named file as it is being viewed. This applies only when the input file is a pipe, not an ordinary file. If the file already exists, _l_e_s_s will ask for confirmation before overwriting it. -O_f_i_l_e_n_a_m_e The -O option is like -o, but it will overwrite an existing file without asking for confirmation. If no log file has been specified, the -o and -O options can be used from within _l_e_s_s to specify a log file. Without a file name, they will simply report the name of the log file. The "s" command is equivalent to specifying -o from within _l_e_s_s_. -p_p_a_t_t_e_r_n The -p option on the command line is equivalent to specifying +/_p_a_t_t_e_r_n; that is, it tells _l_e_s_s to start at the first occurence of _p_a_t_t_e_r_n in the file. 10LESS(1) LESS(1) -P_p_r_o_m_p_t Provides a way to tailor the three prompt styles to your own preference. This option would normally be put in the LESS environment variable, rather than being typed in with each _l_e_s_s command. Such an option must either be the last option in the LESS variable, or be terminated by a dollar sign. -P followed by a string changes the default (short) prompt to that string. -Pm changes the medium (-m) prompt to the string, and -PM changes the long (-M) prompt. Also, -P= changes the message printed by the = command to the given string. All prompt strings consist of a sequence of letters and spe- cial escape sequences. See the section on PROMPTS for more details. -q Causes moderately "quiet" operation: the terminal bell is not rung if an attempt is made to scroll past the end of the file or before the beginning of the file. If the terminal has a "visual bell", it is used instead. The bell will be rung on certain other errors, such as typing an invalid character. The default is to ring the terminal bell in all such cases. -Q Causes totally "quiet" operation: the terminal bell is never rung. -r Causes "raw" control characters to be displayed. The default is to display control characters using the caret notation; for example, a control-A (octal 001) is displayed as "^A". Warning: when the -r flag is used, _l_e_s_s cannot keep track of the actual appearance of the screen (since this depends on how the screen responds to each type of control charac- ter). Thus, various display problems may result, such as long lines being split in the wrong place. -s Causes consecutive blank lines to be squeezed into a single blank line. This is useful when viewing _n_r_o_f_f output. -S Causes lines longer than the screen width to be chopped rather than folded. That is, the remainder of a long line is simply discarded. The default is to fold long lines; that is, display the remainder on the next line. -t_t_a_g The -t option, followed immediately by a TAG, will edit the file containing that tag. For this to work, there must be a file called "tags" in the current directory, which was previously built by the _c_t_a_g_s (1) command. This option may also be specified from within _l_e_s_s (using the - command) as 11LESS(1) LESS(1) a way of examining a new file. The command ":t" is equivalent to specifying -t from within _l_e_s_s_. -T_t_a_g_s_f_i_l_e Specifies a tags file to be used instead of "tags". -u Causes backspaces and carriage returns to be treated as printable characters; that is, they are sent to the terminal when they appear in the input. -U Causes backspaces and carriage returns to be treated as control characters; that is, they are handled as specified by the -r option. By default, if neither -u nor -U is given, backspaces which appear adjacent to an underscore character are treated specially: the underlined text is displayed using the terminal's hardware underlining capability. Also, backspaces which appear between two identical characters are treated specially: the overstruck text is printed using the terminal's hardware boldface capability. Other backspaces are deleted, along with the preceding character. Carriage returns immediately followed by a newline are deleted. Other carriage returns are handled as specified by the -r option. -w Causes blank lines to be used to represent lines past the end of the file. By default, a tilde character is used. -x_n Sets tab stops every _n positions. The default for _n is 8. -y_n Specifies a maximum number of lines to scroll for- ward. If it is necessary to scroll forward more than _n lines, the screen is repainted instead. The -c or -C option may be used to repaint from the top of the screen if desired. By default, any forward movement causes scrolling. -[z]_n Changes the default scrolling window size to _n lines. The default is one screenful. The z and w commands can also be used to change the window size. The "z" may be omitted, as in "-_n" for com- patibility with _m_o_r_e_. + If a command line option begins with ++, the remain- der of that option is taken to be an initial com- mand to _l_e_s_s_. For example, +G tells _l_e_s_s to start at the end of the file rather than the beginning, and +/xyz tells it to start at the first occurrence of "xyz" in the file. As a special case, +<number> acts like +<number>g; that is, it starts the 12
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -