📄 less.nro
字号:
.PP.IP +cmdCauses the specified cmd to be executed each time a new file is examined.For example, +G causes .I lessto initially display each file starting at the end rather than the beginning..PP.IP VPrints the version number of .I less being run..PP.IP "q or :q or :Q or ZZ or ESC ESC"Exits.I less..PPThe following threecommands may or may not be valid, depending on your particular installation..PP.IP vInvokes 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..PP.IP "! shell-command"Invokes a shell to run the shell-command given.A percent sign (%) in the command is replaced by the name of thecurrent 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"..PP.IP "| <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 onthe current screen and the position 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..PP.SH OPTIONSCommand line options are described below.Most options may be changed while.I less is running, via the "\-" command..PPOptions are also taken from the environment variable "LESS".For example, to avoid typing "less -options ..." each time .I less is invoked, you might tell .I csh:.spsetenv LESS "-options".spor if you use .I sh:.spLESS="-options"; export LESS.spThe environment variable is parsed before the command line,so command line options override the LESS environment variable.If an option appears in the LESS variable, it can be resetto its default on the command line by beginning the commandline option with "-+"..spA dollar sign ($) may be used to signal the end of an option string.This is important only for options like -P which take afollowing string..IP -?This option displays a summary of the commands accepted by.I less(the same as the h command).If this option is given, all other options are ignored, and.I lessexits 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: "-\\?".).IP -aCauses searches to start after the last linedisplayed on the screen, thus skipping all lines displayed on the screen.By default, searches start at the second line on the screen(or after the last found line; see the -j option)..IP -b\fIn\fPCauses.I lessto 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 \fIn\fP specifies a different number of buffers to use..IP -BDisables 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 oldestdata is discarded.By default, when data is coming from standard input,buffers are allocated automatically as neededto avoid loss of data..IP -cCauses 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..IP -CThe -C option is like -c, but the screen is cleared before it is repainted..IP -dThe -d option suppresses the error messagenormally 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.I lesson a dumb terminal)..IP -eCauses .I less to automatically exitthe second time it reaches end-of-file.By default, the only way to exit .I lessis via the "q" command..IP -ECauses .I lessto automatically exit the first time it reaches end-of-file..IP -fForces 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,.I lesswill refuse to open non-regular files..IP -h\fIn\fPSpecifies a maximum number of lines to scroll backward.If it is necessary to scroll backward more than \fIn\fP lines,the screen is repainted in a forward direction instead.(If the terminal does not have the ability to scrollbackward, -h0 is implied.).IP -iCauses 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 lettersappear in the search pattern..IP -j\fIn\fPSpecifies a line on the screen where "target" linesare 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 screenis 1, the next is 2, and so on.The number may be negative to specify a line relative to the bottomof the screen: the bottom line on the screen is -1, the secondto the bottom is -2, and so on.If the -j option is used, searches begin at the line immediatelyafter the target line.For example, if "-j4" is used, the target line is thefourth line on the screen, so searches begin at the fifth lineon the screen..IP -k\fIfilename\fPCauses.I lessto open and interpret the named file as a.I lesskey(1) file.Multiple -k options may be specified.If a file called .less exists in the user's home directory, thisfile is also used as a.I lesskeyfile..IP -mCauses .I lessto prompt verbosely (like \fImore\fP),with the percent into the file.By default,.I lessprompts with a colon..IP -MCauses .I lessto prompt even more verbosely than .I more..IP -nSuppresses line numbers.The default (to use line numbers) may cause.I lessto 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 verboseprompt 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)..IP -NCauses a line number to be displayed at the beginning ofeach line in the display..IP -o\fIfilename\fPCauses.I lessto 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, .I lesswill ask for confirmation before overwriting it..IP -O\fIfilename\fPThe -O option is like -o, but it will overwrite an existingfile without asking for confirmation..spIf no log file has been specified,the -o and -O options can be used from within .I lessto 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.I less..IP -p\fIpattern\fPThe -p option on the command line is equivalent to specifying +/\fIpattern\fP;that is, it tells.I lessto start at the first occurence of \fIpattern\fP in the file..IP -P\fIprompt\fPProvides a way to tailor the three promptstyles to your own preference.This option would normally be put in the LESS environmentvariable, rather than being typed in with each .I lesscommand.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 special escape sequences.See the section on PROMPTS for more details..IP -qCauses moderately "quiet" operation:the terminal bell is not rung if an attempt is made to scroll past the end of the fileor 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..IP -QCauses totally "quiet" operation:the terminal bell is never rung..IP -rCauses "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,.I lesscannot keep track of the actual appearance of the screen(since this depends on how the screen responds toeach type of control character).Thus, various display problems may result,such as long lines being split in the wrong place..IP -sCauses consecutive blank lines to be squeezed into a single blank line.This is useful when viewing.I nroffoutput..IP -SCauses lines longer than the screen width to bechopped 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 remainderon the next line..IP -t\fItag\fPThe -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 thecurrent directory, which was previously built by the .I ctags(1) command.This option may also be specified from within .I less (using the \- command) as a way of examining a new file.The command ":t" is equivalent to specifying -t from within.I less..IP -T\fItagsfile\fPSpecifies a tags file to be used instead of "tags"..IP -uCauses backspaces and carriage returns to be treated as printable characters;that is, they are sent to the terminal when they appear in the input..IP -UCauses backspaces and carriage returns to be treated as control characters;that is, they are handled as specified by the -r option..spBy default, if neither -u nor -U is given,backspaces which appear adjacent to an underscore characterare treated specially:the underlined text is displayed using the terminal's hardware underlining capability.Also, backspaces which appear between two identical charactersare 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..IP -wCauses blank lines to be used to represent linespast the end of the file.By default,a tilde character is used.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -