cat:连接文件并打印到标准输出(查看整个文件)tail:输出文件的末尾部分head:输出文件的开头部分grep:强大的文本搜索工具 #可搭配其他命令用 "|"less / more:分页交互式查看文件 #G ? / awk:强大的文本分析和处理语言sed:流编辑器,用于过滤和转换文本sort:对文本行进行排序uniq:报告或忽略重复的行wc:统计行数、单词数、字节数
空格键 / Page Down #向下翻一页b / Page Up #向上翻一页/keyword #向下搜索关键词(按 n 下一个,N 上一个)?keyword #向上搜索关键词G #跳到文件末尾g #跳到文件开头q #退出
查看最新日志 tail -f -n 100 filename.log搜索关键词 grep -C 5 -i "error" filename.log大文件查看 less filename.log统计与分析 awk + sort + uniq 组合实时监控过滤 `tail -f filename.log提取特定字段 awk '{print $1, $5}' filename.log
https://linuxcommandlibrary.com/ #覆盖所有场景的命令网站https://wangchujiang.com/linux-command/ #Github上27K+Start【linux-command】项目