zoukankan      html  css  js  c++  java
  • linux命令--tail

    linux  tail命令,显示文件末尾内容

    语法:tail [参数] [参数值] [文件名称]

    参数说明:

    -n:从文件末尾开始向前显示指定的行数

    -f:从文件末尾开始向前显示指定的行数,当文档有新的内容写入时,动态显示新的内容到屏幕上

    举例说明:

    ------------------------------------------------------------------------------------------------------------------------

    查看1.txt内容

    [root@test tools]# cat 1.txt
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    --------------------------------------------------------------------------------------------------------------------

    查看1.txt末尾5行

    [root@test tools]# tail -n 5 1.txt
    19
    20
    21
    22
    23

    --------------------------------------------------------------------------------------------------------------------

    tail命令默认显示文件末尾10行内容

    [root@test tools]# tail 1.txt
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    --------------------------------------------------------------------------------------------------------------------

    动态显示1.txt尾部内容

    [root@test tools]# tail -f 1.txt
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27

    写入内容后显示:

    [root@test tools]# tail -f 1.txt
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    new1
    new2
    new3
    new4
    new5

    -----------------------------------------------------------------------------------------------------------------

    Ctrl+c 结束正在运行的程序,结束tail -f 命令,可使用Ctrl+c

  • 相关阅读:
    OC学习13——Foundation框架中的集合
    OC学习12——字符串、日期、日历
    OC学习11——循环引用与@class
    OC学习10——内存管理
    OC学习9——反射机制
    OC学习8——异常处理
    OC学习7——类别、扩展和协议
    OC学习6——面相对象的三大特性
    OC学习5——类和对象
    Unity3D应用防外挂与防破解
  • 原文地址:https://www.cnblogs.com/wjunchao/p/5916103.html
Copyright © 2011-2022 走看看