'\" te .\" Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. .\" Copyright 1989 AT&T .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .TH tail 1 "2011 年 7 月 28 日" "SunOS 5.11" "ユーザーコマンド" .SH 名前 tail \- ファイルの最後の部分の出力 .SH 形式 .LP .nf \fB/usr/bin/tail\fR [±s \fInumber\fR [lbcr]] [\fIfile\fR] .fi .LP .nf \fB/usr/bin/tail\fR [\fB-lbcr\fR] [\fIfile\fR] .fi .LP .nf \fB/usr/bin/tail\fR [± \fInumber\fR [lbcf]] [\fIfile\fR] .fi .LP .nf \fB/usr/bin/tail\fR [\fB-lbcf\fR] [\fIfile\fR] .fi .LP .nf \fB/usr/xpg4/bin/tail\fR [\fB-f\fR | \fB-r\fR] [\fB-c\fR \fInumber\fR | \fB-n\fR \fInumber\fR] [\fIfile\fR] .fi .LP .nf \fB/usr/xpg4/bin/tail\fR [± \fInumber\fR [l | b | c] [f]] [\fIfile\fR] .fi .LP .nf \fB/usr/xpg4/bin/tail\fR [± \fInumber\fR [l] [f | r]] [\fIfile\fR] .fi .SH 機能説明 .sp .LP \fBtail\fR ユーティリティーは、指定されたファイルの内容のうち、指定地点から終わりまでを標準出力にコピーします。ファイルの指定がない場合は、標準入力を使用します。 .sp .LP コピーの開始地点は、\fB-c\fR\fInumber\fR、\fB-n\fR\fInumber\fR、\fB±\fR\fInumber\fR の各オプションで指定されます。\fB+\fR\fInumber\fR は先頭からの距離、\fB-\fR\fInumber\fR は末尾からの距離を表します。\fInumber\fR が \fINULL\fR のときは \fB10\fR と見なされます。\fInumber\fR の単位は \fB-c\fR または \fB- n\fR オプションの指定に従い、行またはバイトとなり、さらに \fBl\fR、\fBb\fR、\fBc\fR のいずれかのオプションが指定された場合には、それに従って、行、ブロック、バイトのいずれかとなります。単位指定がすべて省略された場合には、行と見なされます。 .SH オプション .sp .LP 次のオプションは、\fB/usr/bin/tail\fR と \fB/usr/xpg4/bin/tail\fR で指定できます。\fB-r\fR と \fB-f\fR オプションを同時に指定することはできません。両方がコマンド行に指定された場合、\fB-f\fR オプションは無効になります。 .sp .ne 2 .mk .na \fB\fB-b\fR\fR .ad .RS 6n .rt ブロック単位。 .RE .sp .ne 2 .mk .na \fB\fB-c\fR\fR .ad .RS 6n .rt バイト単位。 .RE .sp .ne 2 .mk .na \fB\fB-f\fR\fR .ad .RS 6n .rt 継続。入力ファイルがパイプでない場合、プログラムは入力ファイルの行がコピーされた後に終了せず、無限ループに入り、その中で 1 秒間休止し、入力ファイルからさらにレコードを読み取ったり、コピーしようとします。したがって、このオプションは、ほかのプロセスによって作成中のファイルの成長を監視するために使用できます。 .RE .sp .ne 2 .mk .na \fB\fB-l\fR\fR .ad .RS 6n .rt 行単位。 .RE .sp .ne 2 .mk .na \fB\fB-r\fR\fR .ad .RS 6n .rt 逆順。ファイルに指定された開始点から行を逆の順番にコピーします。\fBr\fR のデフォルトは、ファイル全体を逆順に出力します。 .RE .SS "/usr/xpg4/bin/tail" .sp .LP 次のオプションは、\fB/usr/xpg4/bin/tail\fR でのみ指定できます。 .sp .ne 2 .mk .na \fB\fB-c\fR \fInumber\fR \fR .ad .RS 14n .rt \fInumber\fR オプションの引数は、ファイル内のコピーの開始位置をバイト単位で表す 10 進整数です。符号もファイル内の位置に影響します。 .sp .ne 2 .mk .na \fB\fB+\fR\fR .ad .RS 8n .rt ファイルの先頭からの相対位置を指定してコピーを開始します。 .RE .sp .ne 2 .mk .na \fB\fB-\fR\fR .ad .RS 8n .rt ファイルの末尾からの相対位置を指定してコピーを開始します。 .RE .sp .ne 2 .mk .na \fBnone\fR .ad .RS 8n .rt ファイルの末尾からの相対位置を指定してコピーを開始します。 .RE カウントは 1 から始まります。つまり \fB\fR\fB-c\fR\fB+1\fR はファイルの第 1 バイト目を表し、\fB\fR\fB-c\fR\fB-1\fR は最後のバイトを表します。 .RE .sp .ne 2 .mk .na \fB\fB-n\fR \fInumber\fR\fR .ad .RS 14n .rt ファイル内の開始位置がバイト単位でなく行単位で計測される点を除き、\fB-c\fR\fInumber\fR と同等の意味です。カウントは \fB1\fR から始まります。つまり \fB-n\fR\fB+1\fR はファイルの第 1 行目を表し、\fB-n\fR\fB-1\fR は最後の行を表します。 .RE .SH オペランド .sp .LP 次のオペランドを指定できます。 .sp .ne 2 .mk .na \fB\fIfile\fR\fR .ad .RS 8n .rt 入力ファイルのパス名。\fIfile\fR オペランドを指定しないと、標準入力が使用されます。 .RE .SH 使用法 .sp .LP ファイルが 2G バイト (2^31 バイト) 以上ある場合の \fBtail\fR の動作については、\fBlargefile\fR(5) を参照してください。 .SH 使用例 .LP \fB例 1 \fRtail コマンドの使用 .sp .LP 次のコマンドは、ファイル \fBfred\fR の最後の 10 行を出力し、その後には \fBtail\fR を開始してから終了するまでの間に \fBfred\fR に追加されたすべての行が続きます。 .sp .in +2 .nf example% \fBtail -f fred\fR .fi .in -2 .sp .sp .LP 次のコマンドは、ファイル \fBfred\fR の最後の 15 バイトを出力し、その後には \fBtail\fR を開始してから終了するまでの間に \fBfred\fR に追加されたすべての行が続きます。 .sp .in +2 .nf example% \fBtail -15cf fred\fR .fi .in -2 .sp .SH 環境 .sp .LP \fBtail\fR の実行に影響を与える次の環境変数についての詳細は、\fBenviron\fR(5) を参照してください。\fBLANG\fR、\fBLC_ALL\fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR、および \fBNLSPATH\fR。 .SH 終了ステータス .sp .LP 次の終了ステータスが返されます。 .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 6n .rt 正常終了。 .RE .sp .ne 2 .mk .na \fB>\fB0\fR\fR .ad .RS 6n .rt エラーが発生した。 .RE .SH 属性 .sp .LP 属性についての詳細は、マニュアルページの \fBattributes\fR(5) を参照してください。 .SS "/usr/bin/tail" .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . 属性タイプ属性値 _ 使用条件system/core-os _ CSI有効 .TE .SS "/usr/xpg4/bin/tail" .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . 属性タイプ属性値 _ 使用条件system/xopen/xcu4 _ CSI有効 _ インタフェースの安定性確実 _ 標準T{ \fBstandards\fR(5) を参照してください。 T} .TE .SH 関連項目 .sp .LP \fBcat\fR(1), \fBhead\fR(1), \fBmore\fR(1), \fBpg\fR(1), \fBdd\fR(1M), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5) .SH 注意事項 .sp .LP ファイルの末尾で相対的にパイプされた tail はバッファーに格納されるので、長さに制限があります。文字型の特殊なファイルでは、さまざまな種類の変則的な動作が起こる可能性があります。