78ed81a3 |
1 | .\" Copyright (c) 1980, 1990, 1991 Regents of the University of California. |
2 | .\" All rights reserved. |
3 | .\" |
4 | .\" This code is derived from software contributed to Berkeley by |
5 | .\" the Institute of Electrical and Electronics Engineers, Inc. |
6 | .\" |
7 | .\" Redistribution and use in source and binary forms, with or without |
8 | .\" modification, are permitted provided that the following conditions |
9 | .\" are met: |
10 | .\" 1. Redistributions of source code must retain the above copyright |
11 | .\" notice, this list of conditions and the following disclaimer. |
12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer in the |
14 | .\" documentation and/or other materials provided with the distribution. |
15 | .\" 3. All advertising materials mentioning features or use of this software |
16 | .\" must display the following acknowledgement: |
17 | .\" This product includes software developed by the University of |
18 | .\" California, Berkeley and its contributors. |
19 | .\" 4. Neither the name of the University nor the names of its contributors |
20 | .\" may be used to endorse or promote products derived from this software |
21 | .\" without specific prior written permission. |
22 | .\" |
23 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
24 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
25 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
26 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
27 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
28 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
29 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
31 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
32 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
33 | .\" SUCH DAMAGE. |
34 | .\" |
35 | .\" @(#)tail.1 6.8 (Berkeley) 2/12/92 |
36 | .\" |
37 | .Dd February 12, 1992 |
38 | .Dt TAIL 1 |
39 | .Os BSD 4 |
40 | .Sh NAME |
41 | .Nm tail |
42 | .Nd display the last part of a file |
43 | .Sh SYNOPSIS |
44 | .Nm tail |
45 | .Op Fl f Li | Fl r |
46 | .Oo |
47 | .Fl b Ar number | |
48 | .Fl c Ar number | |
49 | .Fl n Ar number |
50 | .Oc |
51 | .Op Ar file |
52 | .Sh DESCRIPTION |
53 | The |
54 | .Nm tail |
55 | utility displays the contents of |
56 | .Ar file |
57 | or, by default, its standard input, to the standard output. |
58 | .Pp |
59 | The display begins at a byte, line or 512-byte block location in the |
60 | input. |
61 | Numbers having a leading plus (``+'') sign are relative to the beginning |
62 | of the input, for example, |
63 | .Dq -c +2 |
64 | starts the display at the second |
65 | byte of the input. |
66 | Numbers having a leading minus (``-'') sign or no explicit sign are |
67 | relative to the end of the input, for example, |
68 | .Dq -n 2 |
69 | displays the last two lines of the input. |
70 | The default starting location is |
71 | .Dq -n 10 , |
72 | or the last 10 lines of the input. |
73 | .Pp |
74 | The options are as follows: |
75 | .Bl -tag -width Ds |
76 | .It Fl b Ar number |
77 | The location is |
78 | .Ar number |
15637ed4 |
79 | 512-byte blocks. |
78ed81a3 |
80 | .It Fl c Ar number |
81 | The location is |
82 | .Ar number |
83 | bytes. |
84 | .It Fl f |
85 | The |
86 | .Fl f |
87 | option causes |
88 | .Nm tail |
89 | to not stop when end of file is reached, but rather to wait for additional |
90 | data to be appended to the input. |
91 | The |
92 | .Fl f |
93 | option is ignored on pipes but not on FIFO's. |
94 | .It Fl n Ar number |
95 | The location is |
96 | .Ar number |
97 | lines. |
98 | .It Fl r |
99 | The |
100 | .Fl r |
101 | option causes the input to be displayed in reverse order, by line. |
102 | Additionally, this option changes the meaning of the |
103 | .Fl b , |
104 | .Fl c |
105 | and |
106 | .Fl n |
107 | options. |
108 | When the |
109 | .Fl r |
110 | option is specified, these options specify the number of bytes, lines |
111 | or 512-byte blocks to display, instead of the bytes, lines or blocks |
112 | from the beginning or end of the input from which to begin the display. |
113 | The default for the |
114 | .Fl r |
115 | option is to display all of the input. |
116 | .El |
117 | .Pp |
118 | The |
119 | .Nm tail |
120 | utility exits 0 on success, and >0 if an error occurs. |
121 | .Sh SEE ALSO |
122 | .Xr cat 1 , |
123 | .Xr head 1 , |
124 | .Xr sed 1 |
125 | .Sh STANDARDS |
126 | The |
127 | .Nm tail |
128 | utility is expected to be a superset of the POSIX 1003.2 |
129 | specification. |
130 | In particular, the |
131 | .Fl b |
132 | and |
133 | .Fl r |
134 | options are extensions to that standard. |
135 | .Pp |
136 | The historic command line syntax of |
137 | .Nm tail |
138 | is supported by this implementation. |
139 | The only difference between this implementation and historic versions |
140 | of |
141 | .Nm tail , |
142 | once the command line syntax translation has been done, is that the |
143 | .Fl b , |
144 | .Fl c |
145 | and |
146 | .Fl n |
147 | options modify the |
148 | .Fl r |
149 | option, i.e. ``-r -c 4'' displays the last 4 characters of the last line |
150 | of the input, while the historic tail (using the historic syntax ``-4cr'') |
151 | would ignore the |
152 | .Fl c |
153 | option and display the last 4 lines of the input. |
154 | .Sh HISTORY |
155 | A |
156 | .Nm tail |
157 | command appeared in |
158 | .At v7 . |