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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章