The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
<html><head><title>tail</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
</head>
<body class='pod'>
<!--
  generated by Pod::Simple::HTML v3.01,
  using Pod::Simple::PullParser v2.02,
  under Perl v5.008002 at Thu Aug  5 13:56:37 2004 GMT.

 If you want to change this HTML document, you probably shouldn't do that
   by changing it directly.  Instead, see about changing the calling options
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>tail - display the last part of a file</p>

<p>xtail - watch the growth of files</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<p>tail [<b>-f</b> | <b>-r</b>] [<b>-b number</b> | <b>-c number</b> | <b>-n number</b> | <b>[-+]number</b>] [<b>file</b>...]</p>

<p>xtail [<b>-h</b>] file ...</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>The <i>tail</i> utility displays the contents of <b>file</b> or,
by default,
its standard input,
to the standard output.</p>

<p>The display begins at a byte,
line or 512-byte block location in the input.
Numbers having a leading plus (<b>+</b>) sign are relative to the beginning of the input,
for example,
<b>-c +2</b> starts the display at the second byte of the input.
Numbers having a leading minus (<b>-</b>) sign or no explicit sign are relative to the end of the input,
for example,
<b>-n 2</b> displays the last two lines of the input.
The default starting location is <b>-n 10</b>,
or the last 10 lines of the input.</p>

<p>The <i>xtail</i> utility monitors one or more files,
and displays all data written to a file since command invocation.
It is very useful for monitoring multiple logfiles simultaneously.
It may be invoked by renaming <i>tail</i> to <i>xtail</i>,
or by calling <i>tail</i> with the <b>-f</b> option.</p>

<p>With <i>xtail</i> or <i>tail -f</i>,
if an entry given on the command line is a directory,
all files in that directory will be monitored,
including those created after the invocation.
If an entry given on the command line doesn&#39;t exist,
the program will watch for it and monitor it once created.
When switching files in the display,
a banner showing the pathname of the file is printed.</p>

<p>An interrupt character (usually CTRL/C or DEL) will display a list of the most recently modified files being watched.
Send a quit signal (usually CTRL/backslash) to stop the program.</p>

<p>The options are the following for <i>tail</i> (only the <b>-h</b> option is supported by <i>xtail</i>) :</p>

<dl>
<dt><a name="-b_number"
><b>-b number</b></a></dt><p class="pad"></p>

<dd>The location is <b>number</b> 512-byte blocks.</dd><p class="pad"></p>

<dt><a name="-c_number"
><b>-c number</b></a></dt><p class="pad"></p>

<dd>The location is <b>number</b> bytes.</dd><p class="pad"></p>

<dt><a name="-f"
><b>-f</b></a></dt><p class="pad"></p>

<dd>The <b>-f</b> option causes <i>tail</i> to not stop when end-of-file is reached,
but rather to wait for additional data to be appended to the input.
If the file is replaced (ie.
the inode number changes),
<i>tail</i> will reopen the file and continue.
If the file is truncated,
<i>tail</i> will reset its position back to the beginning.
This makes <i>tail</i> more useful for watching log files that may get rotated.
The <b>-f</b> option is ignored if the standard input is a pipe,
but not if it is a FIFO.</dd><p class="pad"></p>

<dt><a name="-h"
><b>-h</b></a></dt><p class="pad"></p>

<dd>Displays a short usage message.</dd><p class="pad"></p>

<dt><a name="-n_number"
><b>-n</b> number</a></dt><p class="pad"></p>

<dd>The location is <b>number</b> lines.</dd><p class="pad"></p>

<dt><a name="-r"
><b>-r</b></a></dt><p class="pad"></p>

<dd>The <b>-r</b> option causes the input to be displayed in reverse order,
by line.
Additionally,
this option changes the meaning of the <b>-b</b>,
<b>-c</b> and <b>-n</b> options.
When the <b>-r</b> option is specified,
these options specify the number of bytes,
lines or 512-byte blocks to display,
instead of the bytes,
lines or blocks from the beginning or end of the input from which to begin the display.
The default for the <b>-r</b> option is to display all of the input.</dd><p class="pad"></p>

<dt><a name="-ddd_where_ddd_is_an_integer"
><b>-ddd</b> where <b>ddd</b> is an integer</a></dt><p class="pad"></p>

<dd>Same as <b>-n ddd</b>.</dd><p class="pad"></p>
</dl>

<p>If more than a single file is specified,
each file is preceded by a header consisting of the string ``*** XXX ***&#39;&#39; where ``XXX&#39;&#39; is the name of the file.</p>

<p>This header also appears with the <b>-f</b> option,
when the file inode has changed.</p>

<p>The <i>tail</i> utility exits 0 on success or &#62;0 if an error occurred.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SEE_ALSO"
>SEE ALSO</a></h1>

<p>cat(1),
head(1),
sed(1)</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="STANDARDS"
>STANDARDS</a></h1>

<p>The <i>tail</i> utility is expected to be a superset of the IEEE Std1003.2-1992 (``POSIX.2&#39;&#39;) specification.
In particular,
the <b>-b</b> and <b>-r</b> options are extensions to that standard.</p>

<p>The historic command line syntax of <i>tail</i> is supported by this implementation.
The only difference between this implementation and historic versions of <i>tail</i>,
once the command line syntax translation has been done,
is that the <b>-b</b>,
<b>-c</b> and <b>-n</b> options modify the -r option,
i.e.
<b>-r -c 4</b> displays the last 4 characters of the last line of the input,
while the historic <i>tail</i> (using the historic syntax <b>-4cr</b>) would ignore the <b>-c</b> option and display the last 4 lines of the input.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="HISTORY"
>HISTORY</a></h1>

<p>A <i>tail</i> command appeared in Version 7 AT&#38;T UNIX.</p>

<p>The original version of <i>xtail</i> was written by Chip Rosenthal.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="BUGS"
>BUGS</a></h1>

<p>This implementation of <i>tail</i> and <i>xtail</i> has no known bugs.
However it has not been completely tested on all systems (yet).</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NOTES"
>NOTES</a></h1>

<p>The <i>xtail</i> implementation opens and reopens file handles very often.
It works pretty well on my system,
but tell me if you have problems monitoring directories with hundreds of log files which vary very often.</p>

<p>Since <i>tail -f</i> or <i>xtail</i> catches the INT signals (CTRL-C),
the program must be stopped a QUIT signal (CTRL-D) or by some other means,
for instance CTRL-Pause on Windows.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

<p>The Perl implementation was written by Thierry Bezecourt,
<i>thbzcrt@worldnet.fr</i>.
Perl Power Tools project,
March 1999.</p>

<p>This documentation comes from the BSD tail(1) man page and from the xtail man page.
The integration of xtail was Tom Christiansen&#39;s idea.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="COPYRIGHT_and_LICENSE"
>COPYRIGHT and LICENSE</a></h1>

<p>This program is free and open software.
You may use,
modify,
distribute,
and sell this program (and any modified variants) in any way you wish,
provided you do not restrict others from doing the same.</p>

<!-- end doc -->

</body></html>