1tail(1) User Commands tail(1)
2
3
4
6 tail - deliver the last part of a file
7
9 /usr/bin/tail [±s number [lbcr]] [file]
10
11
12 /usr/bin/tail [-lbcr] [file]
13
14
15 /usr/bin/tail [± number [lbcf]] [file]
16
17
18 /usr/bin/tail [-lbcf] [file]
19
20
21 /usr/xpg4/bin/tail [-f | -r] [-c number | -n number] [file]
22
23
24 /usr/xpg4/bin/tail [± number [l | b | c] [f]] [file]
25
26
27 /usr/xpg4/bin/tail [± number [l] [f | r]] [file]
28
29
31 The tail utility copies the named file to the standard output beginning
32 at a designated place. If no file is named, the standard input is used.
33
34
35 Copying begins at a point in the file indicated by the -cnumber, -nnum‐
36 ber, or ±number options (if +number is specified, begins at distance
37 number from the beginning; if -number is specified, from the end of the
38 input; if number is NULL, the value 10 is assumed). number is counted
39 in units of lines or byte according to the -c or -n options, or
40 lines, blocks, or bytes, according to the appended option l, b, or c.
41 When no units are specified, counting is by lines.
42
44 The following options are supported for both /usr/bin/tail and
45 /usr/xpg4/bin/tail. The -r and -f options are mutually exclusive. If
46 both are specified on the command line, the -f option is ignored.
47
48 -b Units of blocks.
49
50
51 -c Units of bytes.
52
53
54 -f Follow. If the input-file is not a pipe, the program does not
55 terminate after the line of the input-file has been copied, but
56 enters an endless loop, wherein it sleeps for a second and then
57 attempts to read and copy further records from the input-file.
58 Thus it can be used to monitor the growth of a file that is
59 being written by some other process.
60
61
62 -l Units of lines.
63
64
65 -r Reverse. Copies lines from the specified starting point in the
66 file in reverse order. The default for r is to print the entire
67 file in reverse order.
68
69
70 /usr/xpg4/bin/tail
71 The following options are supported for /usr/xpg4/bin/tail only:
72
73 -c number The number option-argument must be a decimal integer
74 whose sign affects the location in the file, measured in
75 bytes, to begin the copying:
76
77 + Copying starts relative to the beginning of the
78 file.
79
80
81 − Copying starts relative to the end of the file.
82
83
84 none Copying starts relative to the end of the file.
85
86 The origin for counting is 1; that is, -c+1 represents
87 the first byte of the file, -c−1 the last.
88
89
90 -n number Equivalent to -cnumber, except the starting location in
91 the file is measured in lines instead of bytes. The ori‐
92 gin for counting is 1. That is, -n+1 represents the first
93 line of the file, -n−1 the last.
94
95
97 The following operand is supported:
98
99 file A path name of an input file. If no file operands are speci‐
100 fied, the standard input is used.
101
102
104 See largefile(5) for the description of the behavior of tail when
105 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
106
108 Example 1 Using the tail Command
109
110
111 The following command prints the last ten lines of the file fred, fol‐
112 lowed by any lines that are appended to fred between the time tail is
113 initiated and killed.
114
115
116 example% tail -f fred
117
118
119
120
121 The next command prints the last 15 bytes of the file fred, followed by
122 any lines that are appended to fred between the time tail is initiated
123 and killed:
124
125
126 example% tail -15cf fred
127
128
129
131 See environ(5) for descriptions of the following environment variables
132 that affect the execution of tail: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
133 and NLSPATH.
134
136 The following exit values are returned:
137
138 0 Successful completion.
139
140
141 >0 An error occurred.
142
143
145 See attributes(5) for descriptions of the following attributes:
146
147 /usr/bin/tail
148 ┌─────────────────────────────┬─────────────────────────────┐
149 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
150 ├─────────────────────────────┼─────────────────────────────┤
151 │Availability │SUNWcsu │
152 ├─────────────────────────────┼─────────────────────────────┤
153 │CSI │Enabled │
154 └─────────────────────────────┴─────────────────────────────┘
155
156 /usr/xpg4/bin/tail
157 ┌─────────────────────────────┬─────────────────────────────┐
158 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
159 ├─────────────────────────────┼─────────────────────────────┤
160 │Availability │SUNWxcu4 │
161 ├─────────────────────────────┼─────────────────────────────┤
162 │CSI │Enabled │
163 ├─────────────────────────────┼─────────────────────────────┤
164 │Interface Stability │Standard │
165 └─────────────────────────────┴─────────────────────────────┘
166
168 cat(1), head(1), more(1), pg(1), dd(1M), attributes(5), environ(5),
169 largefile(5), standards(5)
170
172 Piped tails relative to the end of the file are stored in a buffer, and
173 thus are limited in length. Various kinds of anomalous behavior can
174 happen with character special files.
175
176
177
178SunOS 5.11 13 Jul 2005 tail(1)