常用linux日志查詢命令


1.查看實時日志:

tail -f nohup.out

2.分頁查看所有日志:

  cat nohup.out | more

  4.分頁查看前N行日志:

tail -n 1000 nohup.out | more

5.查看實時日志並檢索關鍵字:

tail -f nohup.out | grep "關鍵字"

6.檢索日志,並顯示該條日志的前后N行記錄:

cat nohup.out | grep -n -B10 -A10 "關鍵字"

7.查看日志,從第1000行開始,顯示500行:

cat nohup.out | tail -n +1000| head -n 500

### 8.查看日志,顯示1000行到1500行: ```shell cat nohup.out | head -n 1500| tail -n +1000

9.刪除包括關鍵詞的行:

  sed -i '/關鍵詞/d' nohup.out


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM