1、我的2条日志中间隔了几条别的日志,没有紧挨着打在一起 ,现在有第一条日志的关键词(userName),但是需要同时看到这2条日志
这个时候需要grep -A m [keyword],意思是获取含有keyword的那一行+往下的m行日志
扩展下:
grep -A 20 <word>
grep -B 20 <word>
grep -C 20 <word>
应该是after,before,center
2、快速找到运行的jar的部署路径
一般知道运行的jar的名字时,例如xxx.jar,直接ps -ef | grep xxx.jar
有时候并不确切记得名称,直接用 jps | grep xxx即可,xxx可以是关键字(词),不需要知道完整的jar名即可
然后pwdx <pid>即可找到路径