linux 查看某個進程和服務內存占用情況命令


1.先用ps查詢進程號

ps -aux|grep 進程名字 
ps -aux 查看所有進程
刪除進程 kill -9 3664(具體進程號)

1.CPU占用最多的前10個進程: 
ps auxw|head -1;ps auxw|sort -rn -k3|head -10 
2.內存消耗最多的前10個進程 
ps auxw|head -1;ps auxw|sort -rn -k4|head -10 
3.虛擬內存使用最多的前10個進程 

ps auxw|head -1;ps auxw|sort -rn -k5|head -10

返回結果

返回指標說明

%MEM 進程的內存占用率
MAJFL is the major page fault count, 
VSZ 進程所使用的虛存的大小
RSS 進程使用的駐留集大小或者是實際內存的大小(RSS is the "resident set size" meaning physical memory used)
TTY 與進程關聯的終端(tty)

    串行端口終端(/dev/ttySn)
    偽終端(/dev/pty/) 
    控制終端(/dev/tty) 
    控制台終端(/dev/ttyn,   /dev/console) 
    虛擬終端(/dev/pts/n) 

2.查看更詳細的內存占比

cat /proc/3664(具體進程號)/status 

返回結果:(其中VmRSS為進程所占用的內存)

3,查看某個系統服務狀態 使用service命令

service GatewayServerQueue status

4,停止某個系統服務

service GatewayServerQueue stop

5,啟動某個系統服務

service GatewayServerQueue start

6,重啟某個服務 重啟服務指先stop 再start

service GatewayServerQueue restart

 


免責聲明!

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



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