美文网首页
Linux命令日日说(十七)-- tail

Linux命令日日说(十七)-- tail

作者: spt_genius | 来源:发表于2020-03-31 10:54 被阅读0次

tail

语法

tail [options] files

参数

  • -b NUM 显示NUM个块内容,每个块的大小为512byte。(最新的coreutils中并未包含)

  • -c | --byte=[+]NUM 显示文件中最后NUM个字节的内容。

  • -f | --follow=[name|descriptor] 显示文件尾端内容后不关闭输入文件,并且在输入文件的末端出现新内容时实时将它们显示出来。通常用此选项来持续观察日志文件的内容变化情况。

  • -F--follow=name --retry效果一致。

  • -n NUM 显示出最后NUM行的内容,默认值是10.

  • -q | --quiet | --silent 任何情况下不显示文件名。

  • --retry 如果无法访问,会继续尝试打开文件。

  • -s | --sleep-interval=N 配合-f使用,在数据刷新之间睡眠大约N秒(默认为1.0;

  • -v | --verbose 显示文件名信息。

  • -z | --zero-terminated 将所有换行符看做为NUL,不作为新行。

  • --help 显示帮助信息。

  • --version 显示命令版本。


Example

  • tail test

    显示文件默认末尾10行。

    root@3ff83ffc7119:/# tail test
    This is line6
    This is line7
    
    line1 copy
    line2 copy
    line3 copy
    This is line4 copy
    This is line5 copy
    This is line6 copy
    This is line7 copy
    
  • tail -n 5 test

    显示文件指定5行的末尾内容。

    root@3ff83ffc7119:/# tail -n 5 test
    line3 copy
    This is line4 copy
    This is line5 copy
    This is line6 copy
    This is line7 copy
    
  • tail -c 10 test

    显示末尾10个字节的内容。

    root@3ff83ffc7119:/# tail -c 10 test
    ine7 copy
    
  • tail -n 5 -v test

    显示文件名,==> test <==中的test就是文件名。

    root@3ff83ffc7119:/# tail -n 5 -v test
    ==> test <==
    line3 copy
    This is line4 copy
    This is line5 copy
    This is line6 copy
    This is line7 copy
    
  • tail --version

    看下版本信息。

    root@3ff83ffc7119:/# tail --version
    tail (GNU coreutils) 8.28
    Copyright (C) 2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by Paul Rubin, David MacKenzie, Ian Lance Taylor,
    and Jim Meyering.
    

相关文章

  • Linux命令日日说(十七)-- tail

    tail 语法 参数 -b NUM 显示NUM个块内容,每个块的大小为512byte。(最新的coreutils中...

  • Linux 命令20200415

    LINUX 命令 linux - cat 和 tail 区别 cat 命令 和tail命令都是显示数据的命令cat...

  • linux日志查看

    linux 日志查看 tail、head、 cat、tac、sed、less、echo 1、命令格式: tail ...

  • linux tail命令的使用方法详解

    摘要:本文介绍Linux下tail命令的使用方法。linux tail命令用途是依照要求将指定的文件的最后部分输出...

  • Linux - tail命令

    本文介绍Linux下tail命令的使用方法。 linux tail命令用途是依照要求将指定的文件的最后部分输出到标...

  • linux tail命令的使用方法详解

    本文介绍Linux下tail命令的使用方法。linux tail命令用途是依照要求将指定的文件的最后部分输出到标准...

  • Linux-tail命令使用方法详解

    本文介绍Linux下tail命令的使用方法。 linux tail命令用途是依照要求将指定的文件的最后部分输出到标...

  • 看我怎么用tail命令

    本文介绍Linux下tail命令的使用方法 linux tail命令用途是依照要求将指定的文件的最后部分输出到标准...

  • linux,vim和bash命令小册

    linux命令 linux的文本查看命令共有cat,more,less,head,tail这5个命令。cat是输出...

  • linux命令 - tail

    功能 display the last part of a file显示文件结尾内容 文本 用法 tail fil...

网友评论

      本文标题:Linux命令日日说(十七)-- tail

      本文链接:https://www.haomeiwen.com/subject/ogtwuhtx.html