head用法
command
查看文件的开头N行,支持多文件,多文件时会有标题输出
head的多种实现
-
$ head -N file #N是用户指定的行数
-
$ awk 'FNR <= N' file
-
$ sed Nq file
-------------------------------------------------------------------------------
tail用法
command
查看文件的结尾N行,支持多文件,多文件时会有标题输出
跟踪日志输出
-
$ tail -f logfile #此法持续监控某个文件的输出
-
$ less 后加F #等价形式
-
# man less : F
-
Scroll forward, and keep trying to read when the end of file is reached. Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. (The behavior is similar to the "tail -f" command.)
阅读(1419) | 评论(0) | 转发(0) |