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

  • 相关阅读:
    5.Docker服务进程关系
    朴素贝叶斯知识点概括
    k近邻法(KNN)知识点概括
    机器学习的应用实例
    HNU 10111 0-1矩阵
    CSU 1421 Necklace
    Poj 3469 Dual Core CPU
    Poj 2135 Farm Tour
    Poj 3180 The Cow Prom
    HDU 1004 Let the Balloon Rise
  • 原文地址:https://www.cnblogs.com/wjunchao/p/5916103.html
Copyright © 2011-2022 走看看