Linux 搜尋檔案中的字串(grep)
搜尋某個目錄下的所有檔案內容是否包含某個字串,可以使用grep來達到
grep -rnw ‘目錄’ -e ‘要搜尋的字串’
- -r or -R is recursive (遞迴,包含搜尋子目錄)
- -n is line number (顯示行號)
- -w stands for match the whol[……]
搜尋某個目錄下的所有檔案內容是否包含某個字串,可以使用grep來達到
grep -rnw ‘目錄’ -e ‘要搜尋的字串’
很多人查看現在正在執行的process是使用ps aux,但很多過長的指令卻會超過螢幕看不到,這邊列出幾種方式可以查看超過的部份。
ps auxww
ps -efww
ps aux | cat
如果需要更方便觀看可以考慮使用
ps aux | less -+S
ps aux | most[……]