标签:lap 不能 hat paint star 档案 stat name force
less 的用法比起 more 更加的有弹性。在 more 的时候,我们并没有办法向前面翻, 只能往后面看,但若使用了 less 时,就可以使用 [pageup] [pagedown] 等按键的功能来往前往后翻看文件,更容易用来查看一个文件的内容!除此之外,在 less 里头可以拥有更多的搜索功能,不止可以向下搜,也可以向上搜。
-a ........ --search-skip-screen Forward search skips current screen. -b [N] .... --buffers=[N] Number of buffers. -B ........ --auto-buffers Don‘t automatically allocate buffers for pipes. -c -C .... --clear-screen --CLEAR-SCREEN Repaint by clearing rather than scrolling. -d ........ --dumb Dumb terminal. -D [xn.n] . --color=xn.n Set screen colors. (MS-DOS only) -e -E .... --quit-at-eof --QUIT-AT-EOF Quit at end of file. -f ........ --force Force open non-regular files. -F ........ --quit-if-one-screen Quit if entire file fits on first screen. -g ........ --hilite-search Highlight only last match for searches. -G ........ --HILITE-SEARCH Don‘t highlight any matches for searches. -h [N] .... --max-back-scroll=[N] Backward scroll limit. -i ........ --ignore-case Ignore case in searches that do not contain uppercase. -I ........ --IGNORE-CASE Ignore case in all searches. -j [N] .... --jump-target=[N] Screen position of target lines. -J ........ --status-column Display a status column at left edge of screen. -k [file] . --lesskey-file=[file] Use a lesskey file. -L ........ --no-lessopen Ignore the LESSOPEN environment variable. -m -M .... --long-prompt --LONG-PROMPT Set prompt style. -n ........ --line-numbers Don‘t use line numbers. -N ........ --LINE-NUMBERS Use line numbers. -o [file] . --log-file=[file] Copy to log file (standard input only). -O [file] . --LOG-FILE=[file] Copy to log file (unconditionally overwrite). -p [pattern] --pattern=[pattern] Start at pattern (from command line). -P [prompt] --prompt=[prompt] Define new prompt. -q -Q .... --quiet --QUIET --silent --SILENT Quiet the terminal bell. -r -R .... --raw-control-chars --RAW-CONTROL-CHARS Output "raw" control characters. -s ........ --squeeze-blank-lines Squeeze multiple blank lines. -S ........ --chop-long-lines Chop long lines. -t [tag] .. --tag=[tag] Find a tag. -T [tagsfile] --tag-file=[tagsfile] Use an alternate tags file. -u -U .... --underline-special --UNDERLINE-SPECIAL Change handling of backspaces. -V ........ --version Display the version number of "less". -w ........ --hilite-unread Highlight first new line after forward-screen. -W ........ --HILITE-UNREAD Highlight first new line after any forward movement. -x [N[,...]] --tabs=[N[,...]] Set tab stops. -X ........ --no-init Don‘t use termcap init/deinit strings. --no-keypad Don‘t use termcap keypad init/deinit strings. -y [N] .... --max-forw-scroll=[N] Forward scroll limit. -z [N] .... --window=[N] Set size of window. -" [c[c]] . --quotes=[c[c]] Set shell quote characters. -~ ........ --tilde Don‘t display tildes after end of file. -# [N] .... --shift=[N] Horizontal scroll amount (0 = one half screen width)
usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...
显示文件中从第3行起的内容
more +3 /etc/passwd
从文件中查找第一个出现"omc"字符串的行,并从该处前两行开始显示输出
more +/omc /etc/passwd 【+/pattern 在每个档案显示前搜寻该字串(pattern),然后从该字串前两行之后开始显示】
设定每屏显示行数
more -3 /etc/passwd 【-n 定义屏幕大小为n行】
列一个目录下的文件,每4个一列
ls /root/|more –4
less: -N 显示行号
首次展开一页面
回车表示一行
空格表示一屏
PageUp 向前翻一行
PageDown向下走
more:
回车向下
空格一屏
PageUp不能向上走
PageDown向下走
more |
less |
只能向下搜 |
可以随意浏览文件,可以向下,也可向上 |
加载全文 |
查看之前不会加载全文 |
仅可以向下 |
不止可以向下搜,也可以向上搜。 |
标签:lap 不能 hat paint star 档案 stat name force
原文地址:https://www.cnblogs.com/ftl1012/p/less.html