Loose-Info.com
Last Update 2014/03/11
TOP - Unix系OS - FreeBSD - tail(1)

ファイルの末尾部分を表示します。

tail オプション1 ファイルパス1 オプション1(任意) -c 値1 ファイルの末尾から(値1)バイトを表示 「+」を(値1)に付けるとファイルの先頭から(値1)バイトの位置からの出力 -f ファイルの読み込みを継続し、追加データを表示 ※使用例無し -n 値1 ファイルの末尾から(値1)行を表示 「+」を(値1)に付けるとファイルの先頭から(値1)行の位置からの出力 ファイルパス1 表示するファイル

※ オプションなどは個人的に重要と考えられるものを記述しており、記載の無いものは、manページや関連書籍などを参照願います。
※ 実行例の記述は、不要と考えられる部分の削除などの修正を行ったものを掲載しています。
※ 実行例の実行環境はFreeBSD 9.1です。

(例) オプション無し
実行結果
$ tail /usr/include/stdio.h #define getc_unlocked(fp) __sgetc(fp) #define putc_unlocked(x, fp) __sputc(x, fp) #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked(x, stdout) #endif #endif /* __cplusplus */ __END_DECLS #endif /* !_STDIO_H_ */

(例) オプション -c
実行結果
$ tail -c 100 /usr/include/stdio.h ← 末尾から100バイト出力 ed(x) putc_unlocked(x, stdout) #endif #endif /* __cplusplus */ __END_DECLS #endif /* !_STDIO_H_ */ $ tail -c +16300 /usr/include/stdio.h ← 先頭から16300バイトの位置から出力 sferror(p) #define clearerr_unlocked(p) __sclearerr(p) #define fileno_unlocked(p) __sfileno(p) #endif #if __POSIX_VISIBLE >= 199506 #define getc_unlocked(fp) __sgetc(fp) #define putc_unlocked(x, fp) __sputc(x, fp) #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked(x, stdout) #endif #endif /* __cplusplus */ __END_DECLS #endif /* !_STDIO_H_ */

(例) オプション -n
実行結果
$ tail -n 5 /usr/include/stdio.h ← 末尾から5行出力 #endif #endif /* __cplusplus */ __END_DECLS #endif /* !_STDIO_H_ */ $ tail -n +515 /usr/include/stdio.h ← 先頭から515行目から出力 #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked(x, stdout) #endif #endif /* __cplusplus */ __END_DECLS #endif /* !_STDIO_H_ */