linux系統查看命令 linux下查看最消耗CPU、記憶體的進程 1.CPU佔用最多的前10個進程:ps auxw|head -1;ps auxw|sort -rn -k3|head -102.記憶體消耗最多的前10個進程ps auxw|head -1;ps auxw|sort -rn -k4|head -103.虛擬記憶體使用最多的前10個進程ps auxw|head -1;ps auxw|sort -rn -k5|head -10 4.也可以試試 ps auxw --sort=rssps auxw --sort=%cpu 5.看看幾個參數含義 %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) STAT 檢查的狀態:進程狀態使用字元表示的,如R(running正在運行或準備運行)、S(sleeping睡眠)、I(idle空閑)、Z (僵死)、D(不可中斷的睡眠,通常是I/O)、P(等待交換頁)、W(換出,表示當前頁面不在記憶體)、N(低優先順序任務)T(terminate終止)、W has no resident pages D不可中斷 Uninterruptible sleep (usually IO) R正在運行,或在隊列中的進程 S處於休眠狀態 T停止或被追蹤 Z殭屍進程 W進入記憶體交換(從核心2.6開始無效) X死掉的進程 <高優先順序 N低優先順序 L有些頁被鎖進記憶體 s包含子進程 +位於背景進程組; l多線程,複製線程 multi-threaded (using CLONE_THREAD, like NPTL pthreads do)