Tail of common linux commands




tail – output the last part of files


tail [OPTION]… [FILE]…


  • Print the last 10 lines of each FILE to standard output. With morethan 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.
  • Enter the tail of the file. The tail command displays the last 10 lines of the specified file on the screen by default. If more than one file is given, a file name title is added in front of each file displayed. If no file is specified or the file name is’ – ‘, the standard input is read.

-c, --bytes=[+]NUM

  • output the last NUM bytes; or use -c +NUM to output starting with byte NUM of each file
  • Output file tail n (n is an integer) byte content

-f, --follow[={name|descriptor}]

  • output appended data as the file grows;an absent option argument means ‘descriptor’
  • Displays the latest addition to the file“ “Name” means to monitor the change of the file in the form of file name. “- F “is equivalent to” – fdescriptor “


  • same as --follow=name --retry

-n, --lines=[+]NUM

  • output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM
  • Output file tail n (n-digit) line content


  • 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


  • with -f, terminate after process ID, PID dies

-q, --quiet, --silent

  • never output headers giving file names


  • keep trying to open a file if it is inaccessible
  • That is, when the tail command is started, the file is not accessible or becomes inaccessible later, and always tries to open the file. Use this option with the option “- 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
  • Used in conjunction with the “- F” option to specify the number of seconds between monitoring file changes

-v, --verbose

  • always output headers giving file names
  • When there are multiple file parameters, each file name is always output

-z, --zero-terminated

  • line delimiter is NUL, not newline


  • display this help and exit


  • output version information and exit
  • NUM may have a multiplier suffix: b 512, kB 1000, K 1024, MB 10001000, M 10241024,

GB 100010001000, G 102410241024, 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 thefile descriptor (e.g., log rotation). Use --follow=name in thatcase.That causes tail to track the named file in a way that accommodates renaming, removal and creation.


All rights reserved