263. Linux顯示文件
WHY
其實很少用到,
但新服務剛架起來的時候,
就真的很需要他。
Note
Cat
最基礎的用法
缺點是,當內容太多時,會很難看,
此時能搭配grep
做內容搜尋。
cat 123.log
head
取文字檔的最上面幾行
head -n 10 123.log
tail
取文字檔的最後面幾行
tail -n 10 123.log
man
查詢指令用法,
有時用 <command> -h
會找不到使用方式,
此時可用 man <command>
去搜尋
man find
如果要做到後續的處理,寫shellscript,
awk
與 xargs
都是常用的指令。
ref. 10 Essential Terminal Commands Every Developer Should Know