Commit | Line | Data |
---|---|---|
19dad70e CL |
1 | .\" Copyright (c) 1980, 1990, 1991 Regents of the University of California. |
2 | .\" All rights reserved. | |
09d34764 | 3 | .\" |
ae122740 KB |
4 | .\" This code is derived from software contributed to Berkeley by |
5 | .\" the Institute of Electrical and Electronics Engineers, Inc. | |
6 | .\" | |
19dad70e | 7 | .\" %sccs.include.redist.roff% |
09d34764 | 8 | .\" |
31919d23 | 9 | .\" @(#)tail.1 6.9 (Berkeley) %G% |
19dad70e CL |
10 | .\" |
11 | .Dd | |
12 | .Dt TAIL 1 | |
13 | .Os BSD 4 | |
14 | .Sh NAME | |
15 | .Nm tail | |
0da48e03 | 16 | .Nd display the last part of a file |
19dad70e CL |
17 | .Sh SYNOPSIS |
18 | .Nm tail | |
0da48e03 KB |
19 | .Op Fl f Li | Fl r |
20 | .Oo | |
21 | .Fl b Ar number | | |
22 | .Fl c Ar number | | |
23 | .Fl n Ar number | |
19dad70e | 24 | .Oc |
31919d23 | 25 | .Op Ar file ... |
19dad70e CL |
26 | .Sh DESCRIPTION |
27 | The | |
28 | .Nm tail | |
0da48e03 KB |
29 | utility displays the contents of |
30 | .Ar file | |
31 | or, by default, its standard input, to the standard output. | |
32 | .Pp | |
ea8ca20d KB |
33 | The display begins at a byte, line or 512-byte block location in the |
34 | input. | |
0da48e03 | 35 | Numbers having a leading plus (``+'') sign are relative to the beginning |
ea8ca20d KB |
36 | of the input, for example, |
37 | .Dq -c +2 | |
38 | starts the display at the second | |
39 | byte of the input. | |
0da48e03 | 40 | Numbers having a leading minus (``-'') sign or no explicit sign are |
ea8ca20d KB |
41 | relative to the end of the input, for example, |
42 | .Dq -n 2 | |
43 | displays the last two lines of the input. | |
44 | The default starting location is | |
45 | .Dq -n 10 , | |
46 | or the last 10 lines of the input. | |
19dad70e | 47 | .Pp |
0da48e03 | 48 | The options are as follows: |
19dad70e | 49 | .Bl -tag -width Ds |
0da48e03 | 50 | .It Fl b Ar number |
ea8ca20d | 51 | The location is |
19dad70e | 52 | .Ar number |
0da48e03 KB |
53 | 512-byte blocks. |
54 | .It Fl c Ar number | |
ea8ca20d | 55 | The location is |
19dad70e | 56 | .Ar number |
0da48e03 KB |
57 | bytes. |
58 | .It Fl f | |
59 | The | |
60 | .Fl f | |
61 | option causes | |
19dad70e | 62 | .Nm tail |
0da48e03 KB |
63 | to not stop when end of file is reached, but rather to wait for additional |
64 | data to be appended to the input. | |
65 | The | |
66 | .Fl f | |
31919d23 | 67 | option is ignored if the standard input is a pipe, but not if it is a FIFO. |
0da48e03 | 68 | .It Fl n Ar number |
ea8ca20d | 69 | The location is |
19dad70e | 70 | .Ar number |
0da48e03 KB |
71 | lines. |
72 | .It Fl r | |
73 | The | |
74 | .Fl r | |
75 | option causes the input to be displayed in reverse order, by line. | |
76 | Additionally, this option changes the meaning of the | |
77 | .Fl b , | |
78 | .Fl c | |
79 | and | |
80 | .Fl n | |
81 | options. | |
82 | When the | |
83 | .Fl r | |
84 | option is specified, these options specify the number of bytes, lines | |
85 | or 512-byte blocks to display, instead of the bytes, lines or blocks | |
86 | from the beginning or end of the input from which to begin the display. | |
87 | The default for the | |
88 | .Fl r | |
89 | option is to display all of the input. | |
19dad70e CL |
90 | .El |
91 | .Pp | |
31919d23 KB |
92 | If more than a single file is specified, each file is preceded by a |
93 | header consisting of the string | |
94 | .Dq ==> XXX <== | |
95 | where | |
96 | .Dq XXX | |
97 | is the name of the file. | |
98 | .Pp | |
19dad70e CL |
99 | The |
100 | .Nm tail | |
101 | utility exits 0 on success, and >0 if an error occurs. | |
102 | .Sh SEE ALSO | |
0da48e03 KB |
103 | .Xr cat 1 , |
104 | .Xr head 1 , | |
105 | .Xr sed 1 | |
106 | .Sh STANDARDS | |
107 | The | |
19dad70e | 108 | .Nm tail |
0da48e03 KB |
109 | utility is expected to be a superset of the POSIX 1003.2 |
110 | specification. | |
111 | In particular, the | |
ea8ca20d KB |
112 | .Fl b |
113 | and | |
114 | .Fl r | |
115 | options are extensions to that standard. | |
116 | .Pp | |
117 | The historic command line syntax of | |
118 | .Nm tail | |
119 | is supported by this implementation. | |
120 | The only difference between this implementation and historic versions | |
121 | of | |
122 | .Nm tail , | |
123 | once the command line syntax translation has been done, is that the | |
124 | .Fl b , | |
125 | .Fl c | |
126 | and | |
127 | .Fl n | |
128 | options modify the | |
0da48e03 | 129 | .Fl r |
ea8ca20d KB |
130 | option, i.e. ``-r -c 4'' displays the last 4 characters of the last line |
131 | of the input, while the historic tail (using the historic syntax ``-4cr'') | |
132 | would ignore the | |
133 | .Fl c | |
134 | option and display the last 4 lines of the input. | |
19dad70e CL |
135 | .Sh HISTORY |
136 | A | |
0da48e03 | 137 | .Nm tail |
19dad70e CL |
138 | command appeared in |
139 | .At v7 . |