aboutsummaryrefslogtreecommitdiff
path: root/ja/man/man1/tail.1
blob: d47ce600c937d3f6aaaa2db57edfb0d65c21cb99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
.\" Copyright (c) 1980, 1990, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)tail.1	8.1 (Berkeley) 6/6/93
.\" jpman %Id: tail.1,v 1.2 1997/03/29 11:43:59 horikawa Stab %
.\"
.Dd June 6, 1993
.Dt TAIL 1
.Os BSD 4
.Sh 名称
.Nm tail
.Nd ファイルの最後の部分を表示する
.Sh 書式
.Nm
.Op Fl f Li | Fl r
.Oo
.Fl b Ar number |
.Fl c Ar number |
.Fl n Ar number
.Oc
.Op Ar
.Sh 解説
.Nm
は、
.Ar file
が指定されていればそのファイルを、
指定されていなければ標準入力を読み込み、
バイト数、行数、もしくは、512 バイト単位のブロック数で指定された位置
以降を表示します。
.Pp
.Ar number
に ``+'' をつけた場合は、入力の先頭からの指定となります。たとえば、
.Dq -c +2
と指定すれば 2 バイト目から表示されます。
.Ar number
に ``-'' もしくは符号をつけていない場合は、入力の最後からの相対位置の
指定となります。たとえば、
.Dq -n 2
では最後の 2 行が表示されます。デフォルトでは
.Dq -n 10 ,
で、入力の最後から 10 行分が表示されます。
.Pp
オプションとしては以下のものがあります:
.Bl -tag -width Ds
.It Fl b Ar number
512 バイト単位のブロック数で指定します。
.It Fl c Ar number
バイト単位で指定します。
.It Fl f
ファイルの最後に達しても終了せず、入力に追加されるデータを待つようにします。
.Fl f
オプションは、標準入力がパイプの場合は無視されますが、
FIFO の場合は無視されません。
.It Fl n Ar number
行単位で指定します。
.It Fl r
行ごとに、逆順に表示します。また、
.Fl b ,
.Fl c ,
.Fl n
の各オプションの意味も変わり、
それぞれ表示するブロック数、バイト数、行数の指定になります。
デフォルトでは、入力したものがすべて逆に表示されます。
.El
.Pp
もし一つ以上のファイルが指定されていると、それぞれのファイルを表示する前に
.Dq ==> XXX <==
という形式のヘッダを表示します。
ただし
.Dq XXX
はファイル名です。
.Pp
.Nm
は、成功した場合は 0 を、エラーが起きた場合は 1 以上の値を返します。
.Sh 関連項目
.Xr cat 1 ,
.Xr head 1 ,
.Xr sed 1
.Sh 規格
.Nm
ユーティリティは
.St -p1003.2-92
のスーパーセットであると考えられています。特に
.Fl b ,
.Fl r
オプションは拡張されたものです。
.Pp
以前の UNIX とのオプション書式の互換は保たれています。ただし、
.Fl r
オプションが
.Fl b ,
.Fl c ,
.Fl n
修飾オプションとなったため、完全には互換はありません。以前の
.Nm
では ``-4cr'' としても、
.Fl c
が無視されて最後の 4 行が逆順に表示されましたが、本バージョンの
.Nm
では
``-r -c 4'' と解釈され、最後の 4 バイトが表示されます。
.Sh 歴史
.Nm
コマンドは
.At v7 
から登場しました。