`

每天一个linux命令系列 - tail

 
阅读更多

tail

Usage: tail [OPTION]... [FILE]...
Print the last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
  -c, --bytes=K            output the last K bytes; alternatively, use -c +K
                           to output bytes starting with the Kth of each file
  -f, --follow[={name|descriptor}]
                           output appended data as the file grows;
                           -f, --follow, and --follow=descriptor are
                           equivalent
  -F                       same as --follow=name --retry
  -n, --lines=K            output the last K lines, instead of the last 10;
                           or use -n +K to output lines starting with the Kth
      --max-unchanged-stats=N
                           with --follow=name, reopen a FILE which has not
                           changed size after N (default 5) iterations
                           to see if it has been unlinked or renamed
                           (this is the usual case of rotated log files).
                           With inotify, this option is rarely useful.
      --pid=PID            with -f, terminate after process ID, PID dies
  -q, --quiet, --silent    never output headers giving file names
      --retry              keep trying to open a file even when it is or
                             becomes inaccessible; useful when following by
                             name, i.e., with --follow=name
  -s, --sleep-interval=N   with -f, sleep for approximately N seconds
                             (default 1.0) between iterations.
                           With inotify and --pid=P, check process P at
                           least once every N seconds.
  -v, --verbose            always output headers giving file names
      --help     display this help and exit
      --version  output version information and exit

If the first character of K (the number of bytes or lines) is a `+',
print beginning with the Kth item from the start of each file, otherwise,
print the last K items in the file.  K may have a multiplier suffix:
b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.

With --follow (-f), tail defaults to following the file descriptor, which
means that even if a tail'ed file is renamed, tail will continue to track
its end.  This default behavior is not desirable when you really want to
track the actual name of the file, not the file descriptor (e.g., log
rotation).  Use --follow=name in that case.  That causes tail to track the
named file in a way that accommodates renaming, removal and creation.

Report tail bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'tail invocation'

分享到:
评论

相关推荐

    主要是在学习Linux常用命令的时候的一些总结与心得_Linux-study-notes.zip

    Linux是一种广泛使用的自由和开放源代码的类Unix操作系统,以其强大的命令行...Linux命令的学习和实践是一个持续的过程,需要不断地复习和应用。通过日积月累的努力,可以逐渐提高在Linux环境下进行高效工作的能力。

    linux-ConfigLinux配置Linux服务器的自动化脚本

    2. **脚本结构**:一个基本的shell脚本通常包括shebang(#!/bin/bash)用于指定解释器,变量声明,函数定义,以及一系列命令。 3. **控制结构**:如条件语句(if-else,case),循环(for,while,until),以及...

    linux学习资料

    Linux是一种广泛使用的开源操作系统,其学习资源和资料非常多,适合初学者逐步深入学习。...这份学习资料按每天学习一个命令的方式,为初学者提供了一个系统学习Linux命令的途径,帮助用户逐步精通Linux操作。

    Liunx系统定时删除任务,定时清理日志,定时清理任务

    `crontab`是Linux下的一个计划任务调度命令,它允许用户定义周期性的任务。每个Linux用户都可以有自己的crontab配置,系统级的任务则存储在`/etc/crontab`文件中。 要使用`crontab`,首先需要打开终端并输入`...

    Linux 一句话精彩问答

    在Linux的世界里,每一行代码、每一个命令都可能蕴藏着丰富的知识与技巧。这里,我们通过一系列精炼的一句话问答,深入浅出地探索Linux操作系统的核心概念、常用命令以及系统管理的方方面面。让我们一同走进这个开放...

    linux技术支持面试题.pdf

    2. **网卡配置文件路径**:在大多数Linux发行版中,网络接口的配置文件通常位于`/etc/sysconfig/network-scripts/`目录下,文件名为`ifcfg-eth0`(eth0代表第一个以太网接口)。 3. **远程连接工具**:常用的远程...

    linux定时任务详解.docx

    `cron` 是一个守护进程(后台服务),用于管理周期性的计划任务。这些任务由 cron 表定义,可以精确到分钟,并且可以设定为每周、每月或其他周期性地执行。`cron` 任务通常被称作“crontab”。 #### 二、配置定时...

Global site tag (gtag.js) - Google Analytics