竹磬网-邵珠庆の日记 生命只有一次,你可以用它来做些更多伟大的事情–Make the world a little better and easier


92月/123

linux 查看文件方式总结

发布在 邵珠庆

查看文件的命令有:cat、more、less、head、sed和tail等。

例:
查看文件的前5行:  head -5 test.log
查看文件的后2行: tail -2 test.log  或 tail -n 2 test.log
查看文件中间一段:sed -n '5,10p' test.log
这样你就可以只查看文件的第5行到第10行。

另外有个比较常用的效果是实时监视,即不停地读取最新内容,这时可以用t

[......]阅读全文