Linux Shell-tail

Source: Internet
Author: User
Tags inotify

Use tail--help to view commands for memo

tail [-f] [-c number |  -N Number |  -M number |  -B number | -K number] [File]

Usage:tail [OPTION] ... [FILE] ...
Print the last ten 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 if file is-, read standard input.

Mandatory arguments to long options is Mandatory for short options too.
-C,--bytes=k output the last K bytes; or use-c +k to output
Bytes starting with the Kth of each file
- F,--follow[={name|descriptor}]
Output appended data as the file grows;
An absent option argument means ' descriptor '

(PS:The parameter-F enables tail to read the latest content continuously; e.g:tail-f-N 500 monitor displays 500 tail-line content)
- FSame as--follow=name--retry
-N,--lines=k output the last K-lines, instead of the last 10;
or use-n +k to output starting with the Kth
--max-unchanged-stats=n
With--follow=name, reopen a FILE which have not
Changed size after N (default 5) iterations
To see if it has been unlinked or renamed
(This was 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 if it is inaccessible
-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, KB, K 1024x768, 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'll continue to track
its end. This default behavior isn't desirable when you really want to
Track the actual name of the file, not the file descriptor (e.g., log
rotation). Use the--follow=name in the case. that causes tail
Named file in A is the accommodates renaming, removal and creation.

Linux Shell-tail

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.