找回密码
 立即注册
Qt开源社区 门户 查看内容

【技术篇:Linux shell】Linux shell 操作命令 more

2019-9-30 09:56| 发布者: admin| 查看: 438| 评论: 0

摘要: Linux shell 操作命令 more Linux shell 命令行 让你真正开始 Linux之旅,本文描述Linux 操作命令 more1、简介 more 命令,功能类似 catcat 命令是将整个文件的内容从上到下显示在屏幕上more 命令会一页一页的显示 ...


Linux shell 操作命令 more

    Linux shell 命令行 让你真正开始 Linux之旅,本文描述 Linux 操作命令 more

1、简介

    more 命令,功能类似 cat

  • cat 命令是将整个文件的内容从上到下显示在屏幕上

  • more 命令会一页一页的显示

    • 按空白键(space)往下一页显示

    • 按 b 键就会往回(back)一页显示

    • 搜寻字串的功能


2、主要功能

    more 命令从前向后读取文件,内容从上到下显示在屏幕上,因此在启动时就加载整个文件

    3、用法/命令格式more[选项] {文件}

    4、常用参数解析

    4.1 常用参数

    语法

    参数

    说明

    more {文件} ... {文件N}


    将文件的内容从上到下显示在屏幕上


    4.2 常用操作

        more 命令 显示 之后,会有一些 基本的操作

    按键

    说明

    =

    输出当前行的行号

    q

    退出 more

    "空格键" 或者 "Ctrl + F" 组合键

    向下滚动一屏

    b

    返回上一屏


    5、辅助功能

    5.1 行号显示

    5.1.1 第n行 开始显示

    语法

    参数

    说明

    more +{number} {文件}


    从笫 n 行开始显示
      # more +3 /etc/hosts
      # The following lines are desirable for IPv6 capable hosts::1 localhost ip6-localhost ip6-loopbackff02::1 ip6-allnodesff02::2 ip6-allrouters

      5.1.2 输出 显示 n 行

      语法

      参数

      说明

      more -{number} {文件}


      定义屏幕大小为 n 行
        # more -3 /etc/hosts127.0.0.1 localhost127.0.1.1  ubuntu


        5.1.3 连续空行显示 一行

        语法

        参数

        说明

        more -s {文件}


        把连续的多个空行显示为一行


        5.2 字符搜索

        语法

        参数

        说明

        more +/{string} {文件}


        在每个档案显示前搜寻该字串(string),然后从该字串前两行之后开始显示
          # more +/ff02 /etc/hosts
          ...skipping# The following lines are desirable for IPv6 capable hosts::1 localhost ip6-localhost ip6-loopbackff02::1 ip6-allnodesff02::2 ip6-allrouters

          5.3 清屏显示

          语法

          参数

          说明

          more -c {文件}


          从顶部清屏,然后显示

          more -p {文件}


          通过清除窗口而不是滚屏来对文件进行换页,与-c 选项相似


          5.4 提示 信息

          语法

          参数

          说明

          more -d {文件}


          提示"Press space to continue,'q' to quiet",禁用响铃功能


          5.5 去除 下划线


          语法

          参数

          说明

          more -u {文件}


          把文件内容中的下画线去掉

            # more -u /etc/hosts127.0.0.1 localhost127.0.1.1 ubuntu
            # The following lines are desirable for IPv6 capable hosts::1 localhost ip6-localhost ip6-loopbackff02::1 ip6-allnodesff02::2 ip6-allrouters



            微信公众号 欢迎 扫码 关注







            ----------------------------------------------------------------------------------------------------------------------
            我们尊重原创,也注重分享,文章来源于微信公众号:石头逍遥,建议关注公众号查看原文。如若侵权请联系qter@qter.org。
            ----------------------------------------------------------------------------------------------------------------------

            鲜花

            握手

            雷人

            路过

            鸡蛋
            
            公告
            可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了