cat more less
cat somefile 一次性将文件内容全部输出(控制台)
more somefile 可以翻页查看, 下翻一页(空格) 上翻一页(b) 退出(q)
less somefile 可以翻页查看,下翻一页(空格) 上翻一页(b),上翻一行(↑) 下翻一行(↓)
head tail
输出文件最后的部分
语法:
tail [OPTION]… [FILE]…
参数:
参数 | 描述 |
---|---|
-c, --bytes=[+]NUM | 输出最后的NUM bytes |
-f, --follow[={name|descriptor}] | 输出文件更新的内容 |
-F | 和–follow相同 |
-n, --lines=[+]NUM | 指定输出的行数,默认输出10行 |
-q, --quiet, --silent | 不在头部输出文件名 |
-s, --sleep-interval=N | 当在-f的情景下,设置监控的时间间隔 |
-v, --verbose | 输出文件的名称 |
-z, --zero-terminated | line delimiter is NUL, not newline |
–max-unchanged-stats=N | with --follow=name, reopen a FILE which has not |
–pid=PID | with -f, terminate after process ID, PID dies |
–retry | keep trying to open a file if it is inaccessible |
例子:
tail -n 10 -f -s 1 ./log.log
没1秒展示log.log
文件最后10行