tac 命令用於按相反順序逐行鏈接和打印文件內容。正則表達式
和 cat 命令同樣,將每一個文件鏈接到標準輸出,但順序相反,逐行打印,首先打印最後一行。這對於檢查按時間順序排列的日誌文件頗有用(例如),其中文件的最後一行包含最新的信息。centos
tac [OPTION] ... [FILE] ...
-b #在以前而不是以後鏈接分隔符 -r #將分隔符做爲基礎正則表達式(BRE)處理 -s #使用STRING做爲分隔符代替默認的換行符 --help #顯示幫助信息並退出 --version #顯示版本信息並退出
反向輸出一個文件,從最後一行開始到第一行(與cat對比顯示)centos7
[root@centos7 ~]# tac test.txt This is also also a test line This is also a test line This is also a test line This is a test line This is a test line This is a test line [root@centos7 ~]# cat test.txt This is a test line This is a test line This is a test line This is also a test line This is also a test line This is also also a test line
天天學一個 Linux 命令(100):iotopcrontab