zoukankan      html  css  js  c++  java
  • 【Linux】tail命令

    用途

    tail命令主要用于取出后边几行


    全称

    tail命令的全称即为tail(尾巴)


    参数

    -n :后边接数字,代表显示几行的意思

    -f :循环读取

    -q :不显示处理信息

    -v :显示详细的处理信息


    案例

    案例一:显示文件最后5行内容

    [root@bigdata ~]# tail -5 /etc/man_db.conf
    #
    #---------------------------------------------------------
    # Flags.
    # NOCACHE keeps man from creating cat pages.
    #NOCACHE


    案例二:循环查看文件内容

    [root@bigdata /]# ping localhost >test.txt &

    [4] 9944
    [root@bigdata /]# tail -f test.txt
    64 bytes from localhost (127.0.0.1): icmp_seq=1791 ttl=64 time=0.112 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=1792 ttl=64 time=0.161 ms
      bytes from localhost (127.0.0.1): icmp_seq=1793 ttl=64 time=0.166 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=1794 ttl=64 time=0.133 ms

    ….


    想要结束按CTRL+C即可


    案例三:从第5行开始显示文件

    [root@bigdata /]# tail -n +5 /etc/man_db.conf
    # their PATH environment variable. For details see the manpath(5) man page.
    #
    # Lines beginning with `#' are comments and are ignored. Any combination of
    # tabs or spaces may be used as `whitespace' separators.
    #
    # There are three mappings allowed in this file:
    # --------------------------------------------------------
    # MANDATORY_MANPATH            manpath_element
    # MANPATH_MAP        path_element    manpath_element
    # MANDB_MAP        global_manpath    [relative_catpath]
    #---------------------------------------------------------

    ……

  • 相关阅读:
    UITextField最大字符数和最大字节数的限制
    Python profiling
    Glow Android 优化实践
    当 NSDictionary 遇见 nil
    TCP/IP详解2 学习笔记---mbuf
    行业代码获取最近代码
    词语、句子相似度比较
    从word得到表格数据插入数据库(6位行业代码)
    python遍历数组获取下标
    计算机浮点数表示
  • 原文地址:https://www.cnblogs.com/OliverQin/p/9482051.html
Copyright © 2011-2022 走看看