less 的用法比起 more 更加的有弹性。在 more 的时候,我们并没有办法向前面翻, 只能往后面看,但若使用了 less 时,就可以使用 [pageup] [pagedown] 等按键的功能来往前往后翻看文件,更容易用来查看一个文件的内容!除此之外,在 less 里头可以拥有更多的搜索功能,不止可以向下搜,也可以向上搜。

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)

more常见命令参数

usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...

常用的命令展示

显示文件中从第3行起的内容

more  +3  /etc/passwd

从文件中查找第一个出现"omd"字符串的行,并从该处前两行开始显示输出

more +/omd /etc/passwd 【+/pattern 在每个档案显示前搜寻该字串(pattern),然后从该字串前两行之后开始显示】

设定每屏显示行数

more -3 /etc/passwd 【-n   定义屏幕大小为n行】

列一个目录下的文件,每4个一列

ls /root/|more –4

more和less的使用技巧

less: -N  显示行号

首次展开一页面

回车表示一行

空格表示一屏

PageUp 向前翻一行

PageDown向下走

more:

回车向下

空格一屏

PageUp不能向上走

PageDown向下走

more和less的区别

more

less

只能向下搜

可以随意浏览文件,可以向下,也可向上

加载全文

查看之前不会加载全文

仅可以向下

不止可以向下搜,也可以向上搜。

Linux less/more命令详解的更多相关文章

  1. Linux下ps命令详解 Linux下ps命令的详细使用方法

    http://www.jb51.net/LINUXjishu/56578.html Linux下的ps命令比较常用 Linux下ps命令详解Linux上进程有5种状态:1. 运行(正在运行或在运行队列 ...

  2. linux之find命令详解

    linux之find命令详解 查找文件find ./ -type f查找目录find ./ -type d查找名字为test的文件或目录find ./ -name test查找名字符合正则表达式的文件 ...

  3. Linux下rar命令详解

    Linux下rar命令详解 用法: rar <命令> -<选项1> ….-<选项N> < 操作文档> <文件…> <@文件列表…> ...

  4. linux下tar命令详解

     linux下tar命令详解    tar是Linux环境下最常用的备份工具之一.tar(tap archive)原意为操作磁带文件,但基于Linux的文件操作机制,同样也可适用于普通的磁盘文件.ta ...

  5. Linux下chkconfig命令详解(转)

    Linux下chkconfig命令详解 chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接. ...

  6. Linux 之Cut命令详解

    摘自:http://blog.csdn.net/zsf8701/article/details/7718680 Linux 之Cut命令详解 cut是一个选取命令,就是将一段数据经过分析,取出我们想要 ...

  7. Linux知识积累(4) Linux下chkconfig命令详解

    Linux下chkconfig命令详解 chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接. ...

  8. Linux下top命令详解

    Linux下top命令详解 top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器.top是一个动态显示过程,即可以通过用户按键来不断刷 ...

  9. LINUX系统VMSTAT命令详解

    linux系统vmstat命令详解 [转自 https://www.cnblogs.com/wensiyang0916/p/6514820.html] vmstat 1    1表示每秒采集一次vms ...

  10. 【转帖】Linux定时任务Crontab命令详解

    Linux定时任务Crontab命令详解 https://www.cnblogs.com/intval/p/5763929.html 知道有crontab 以及 at 命令 改天仔细学习一下 讲sys ...

随机推荐

  1. Cacheable redis 宕机

    使用Cacheable注解Redis方法时,如果Redis服务器挂了,就直接抛出异常了, java.net.ConnectException: Connection refused: connect ...

  2. Chrome 谷歌如何快速实现跨域

    第一步:在你的E盘或者其他盘新建一个文件夹,命名为:E:\MyChromeDevUserData 第二步:找到你的谷歌浏览器快捷图标,鼠标右键选择属性,出现以下界面: 第三步:在目标选项的最后添加:  ...

  3. 马尔科夫随机场(Markov Random Field)

    马尔可夫随机场(Markov Random Field),它包含两层意思:一是什么是马尔可夫,二是什么是随机场. 马尔可夫过程可以理解为其当前的状态只与上一刻有关而与以前的是没有关系的.X(t+1)= ...

  4. The "tsconfig.json" file must have compilerOptions.sourceMap set to true

    在编译ionic项目的时候出现:Error:The "tsconfig.json" file must have compilerOptions.sourceMap set to ...

  5. 关于git远程版本库的一些问题之解决

    Part1:CentOS6.5免密码登录 修改/etc/ssh/sshd_config RSAAuthentication yesPubkeyAuthentication yesAuthorizedK ...

  6. Spring Boot学习笔记(六)mybatis配置多数据源

    application.properties #数据库配置 #数据源类型 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource # ...

  7. javaweb jdbc实现简单的数据库基本操作和servlet的作用域以及jsp标签的使用

    一,工具类,分页类和连接数据库jdbc package com.direct.util; import java.sql.Connection; import java.sql.DriverManag ...

  8. 关于Datagridview控件用法的一些总结

    一.引言 Datagridview控件在winform开发中还是比较常用,一般的数据库系统都会使用它,但是想要友好的展示数据,形成良好的用户界面,那么就要对c#库中默认的Datagridview设置进 ...

  9. CSS-带尖角的对话框

    效果图: box1的代码: .box{ position: relative; width: 200px; height: 200px; border: 2px solid #000; backgro ...

  10. angularjs ui-view多视口多层嵌套路由配置

    最近研究了一下ui-view多层嵌套,整理了一下 1.最简单的ui-view用法 html部分: <ul class="nav navbar-nav"> <li ...