1.命令行輸入top回車,然后按下大寫M按照memory排序,按下大寫P按照CPU排序。
2. ps -ef | grep "進(jìn)程名"
ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep 進(jìn)程名
例如:
# ps -ef | grep mongodb | grep -v grep
root 18512 1 8 Feb28 ? 11:25:23 mongod -f mongodb.conf
# ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep 18512 | grep -v grep
18512 mongod mongod -f mongodb.conf 8.0 6243952 7924496 Feb28 root 0
備注:
pid:進(jìn)程的ID
vsz:進(jìn)程占用的虛擬內(nèi)存
rsz:進(jìn)程占用的物理內(nèi)存
3. top -d 1 -p pid
例如:
# top -d 1 -p 18512
top - 13:18:41 up 9 days, 19:53, 3 users, load average: 0.00, 0.00, 0.00
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3%us, 0.3%sy, 0.0%ni, 99.2%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 8191244k total, 7929432k used, 261812k free, 122160k buffers
Swap: 20479996k total, 16232k used, 20463764k free, 1316248k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
18512 root 20 0 7738m 6.0g 5472 S 1.0 76.3 685:26.98 mongod
4. pmap -x pid
例如:
# pmap -x 18512
18512: mongod -f mongodb.conf
Address Kbytes RSS Dirty Mode Mapping
0000192c8d4c8000 655360 0 0 ----- [ anon ]
00007f9228ae4000 4 0 0 ----- [ anon ]
00007f9228ae5000 10240 20 20 rw--- [ anon ]
00007f9229ee6000 4 0 0 ----- [ anon ]
00007f9229ee7000 10240 16 16 rw--- [ anon ]
00007f922a8e7000 4 0 0 ----- [ anon ]
00007f922a8e8000 1024 20 20 rw--- [ anon ]
00007f922aae9000 4 0 0 ----- [ anon ]
00007f922aaea000 10240 16 16 rw--- [ anon ]
00007f922b4ea000 4 0 0 ----- [ anon ]
00007f922b4eb000 10240 16 16 rw--- [ anon ]
00007f922beeb000 4 0 0 ----- [ anon ]
00007f922beec000 1024 24 24 rw--- [ anon ]
00007f922bfec000 4 0 0 ----- [ anon ]
00007f922bfed000 1024 20 20 rw--- [ anon ]
00007f922c0ed000 4 0 0 ----- [ anon ]
00007f922c0ee000 10240 20 20 rw--- [ anon ]
00007f922caee000 4 0 0 ----- [ anon ]
00007f922caef000 10240 12 12 rw--- [ anon ]
00007f922d4ef000 4 0 0 ----- [ anon ]
00007f922d4f0000 10240 52 52 rw--- [ anon ]
00007f922def0000 4 0 0 ----- [ anon ]
00007f922def1000 10240 52 52 rw--- [ anon ]
00007f922e8f1000 4 0 0 ----- [ anon ]
00007f922e8f2000 10240 52 52 rw--- [ anon ]
00007f922f2f2000 4 0 0 ----- [ anon ]
00007f922f2f3000 10240 52 52 rw--- [ anon ]
00007f922fcf3000 4 0 0 ----- [ anon ]
00007f922fcf4000 10240 52 52 rw--- [ anon ]
00007f92306f4000 4 0 0 ----- [ anon ]
00007f92306f5000 10240 52 52 rw--- [ anon ]
00007f92310f5000 4 0 0 ----- [ anon ]
00007f92310f6000 10240 52 52 rw--- [ anon ]
00007f9231af6000 4 0 0 ----- [ anon ]
00007f9231af7000 10240 52 52 rw--- [ anon ]
00007f92324f7000 4 0 0 ----- [ anon ]
00007f92324f8000 10240 52 52 rw--- [ anon ]
00007f9232ef8000 4 0 0 ----- [ anon ]
00007f9232ef9000 10240 52 52 rw--- [ anon ]
00007f92338f9000 4 0 0 ----- [ anon ]
00007f92338fa000 10240 52 52 rw--- [ anon ]
00007f92342fa000 4 0 0 ----- [ anon ]
00007f92342fb000 10240 52 52 rw--- [ anon ]
00007f9234cfb000 4 0 0 ----- [ anon ]
00007f9234cfc000 10240 52 52 rw--- [ anon ]
00007f92356fc000 4 0 0 ----- [ anon ]
00007f92356fd000 10240 52 52 rw--- [ anon ]
00007f92360fd000 4 0 0 ----- [ anon ]
00007f92360fe000 10240 52 52 rw--- [ anon ]
00007f9236afe000 4 0 0 ----- [ anon ]
00007f9236aff000 10240 52 52 rw--- [ anon ]
00007f92374ff000 4 0 0 ----- [ anon ]
00007f9237500000 10240 16 16 rw--- [ anon ]
00007f9237f00000 4 0 0 ----- [ anon ]
00007f9237f01000 10240 12 12 rw--- [ anon ]
00007f9238901000 4 0 0 ----- [ anon ]
00007f9238902000 10240 48 48 rw--- [ anon ]
00007f9239302000 4 0 0 ----- [ anon ]
00007f9239303000 10240 28 28 rw--- [ anon ]
00007f9239d03000 4 0 0 ----- [ anon ]
00007f9239d04000 10240 8 8 rw--- [ anon ]
00007f923a704000 4 0 0 ----- [ anon ]
00007f923a705000 10240 8 8 rw--- [ anon ]
00007f923b105000 4 0 0 ----- [ anon ]
00007f923b106000 10240 8 8 rw--- [ anon ]
00007f923bb06000 4 0 0 ----- [ anon ]
00007f923bb07000 10240 8 8 rw--- [ anon ]
00007f923c507000 4 0 0 ----- [ anon ]
00007f923c508000 10240 8 8 rw--- [ anon ]
00007f923cf08000 4 0 0 ----- [ anon ]
00007f923cf09000 10240 8 8 rw--- [ anon ]
00007f923d909000 4 0 0 ----- [ anon ]
00007f923d90a000 10240 8 8 rw--- [ anon ]
00007f923e30a000 4 0 0 ----- [ anon ]
00007f923e30b000 10240 8 8 rw--- [ anon ]
00007f923ed0b000 4 0 0 ----- [ anon ]
00007f923ed0c000 10240 8 8 rw--- [ anon ]
00007f923f70c000 4 0 0 ----- [ anon ]
00007f923f70d000 10240 8 8 rw--- [ anon ]
00007f924010d000 4 0 0 ----- [ anon ]
00007f924010e000 10240 8 8 rw--- [ anon ]
00007f9240b0e000 4 0 0 ----- [ anon ]
00007f9240b0f000 10240 8 8 rw--- [ anon ]
00007f924150f000 4 0 0 ----- [ anon ]
00007f9241510000 10240 8 8 rw--- [ anon ]
00007f9241f10000 4 0 0 ----- [ anon ]
00007f9241f11000 10240 8 8 rw--- [ anon ]
00007f9242911000 4 0 0 ----- [ anon ]
00007f9242912000 10240 8 8 rw--- [ anon ]
00007f9243312000 4 0 0 ----- [ anon ]
00007f9243313000 10240 8 8 rw--- [ anon ]
00007f9243d13000 4 0 0 ----- [ anon ]
00007f9243d14000 10240 8 8 rw--- [ anon ]
00007f9244714000 4 0 0 ----- [ anon ]
00007f9244715000 10240 20 20 rw--- [ anon ]
00007f9245115000 4 0 0 ----- [ anon ]
00007f9245116000 10240 16 16 rw--- [ anon ]
00007f9245b16000 4 0 0 ----- [ anon ]
00007f9245b17000 10240 16 16 rw--- [ anon ]
00007f9246517000 4 0 0 ----- [ anon ]
00007f9246518000 10240 8 8 rw--- [ anon ]
00007f9246f18000 4 0 0 ----- [ anon ]
00007f9246f19000 10240 12 12 rw--- [ anon ]
00007f9247919000 4 0 0 ----- [ anon ]
00007f924791a000 10240 8 8 rw--- [ anon ]
00007f924831a000 4 0 0 ----- [ anon ]
00007f924831b000 10240 8 8 rw--- [ anon ]
00007f9248d1b000 4 0 0 ----- [ anon ]
00007f9248d1c000 10240 28 28 rw--- [ anon ]
00007f924971c000 4 0 0 ----- [ anon ]
00007f924971d000 10240 8 8 rw--- [ anon ]
00007f924a11d000 4 0 0 ----- [ anon ]
00007f924a11e000 10240 16 16 rw--- [ anon ]
00007f924ab1e000 4 0 0 ----- [ anon ]
00007f924ab1f000 10240 16 16 rw--- [ anon ]
00007f924b51f000 4 0 0 ----- [ anon ]
00007f924b520000 10240 8 8 rw--- [ anon ]
00007f924bf20000 4 0 0 ----- [ anon ]
00007f924bf21000 10240 44 44 rw--- [ anon ]
00007f924c921000 4 0 0 ----- [ anon ]
00007f924c922000 10240 8 8 rw--- [ anon ]
00007f924d322000 4 0 0 ----- [ anon ]
00007f924d323000 10240 8 8 rw--- [ anon ]
00007f924dd23000 4 0 0 ----- [ anon ]
00007f924dd24000 10240 20 20 rw--- [ anon ]
00007f924e724000 4 0 0 ----- [ anon ]
00007f924e725000 10240 20 20 rw--- [ anon ]
00007f924f125000 4 0 0 ----- [ anon ]
00007f924f126000 10240 44 44 rw--- [ anon ]
00007f924fb26000 4 0 0 ----- [ anon ]
00007f924fb27000 10240 8 8 rw--- [ anon ]
00007f9250527000 4 0 0 ----- [ anon ]
00007f9250528000 10240 44 44 rw--- [ anon ]
00007f9250f28000 4 0 0 ----- [ anon ]
00007f9250f29000 10240 44 44 rw--- [ anon ]
00007f9251929000 4 0 0 ----- [ anon ]
00007f925192a000 10240 44 44 rw--- [ anon ]
00007f925232a000 4 0 0 ----- [ anon ]
00007f925232b000 10240 44 44 rw--- [ anon ]
00007f9252d2b000 4 0 0 ----- [ anon ]
00007f9252d2c000 10240 12 12 rw--- [ anon ]
00007f925372c000 4 0 0 ----- [ anon ]
00007f925372d000 10240 12 12 rw--- [ anon ]
00007f925412d000 4 0 0 ----- [ anon ]
00007f925412e000 10240 8 8 rw--- [ anon ]
00007f9254b2e000 4 0 0 ----- [ anon ]
00007f9254b2f000 10240 8 8 rw--- [ anon ]
00007f925552f000 4 0 0 ----- [ anon ]
00007f9255530000 10240 8 8 rw--- [ anon ]
00007f9255f30000 1576 480 0 r-x-- libc-2.12.so
00007f92560ba000 2048 0 0 ----- libc-2.12.so
00007f92562ba000 16 16 16 r---- libc-2.12.so
00007f92562be000 8 8 8 rw--- libc-2.12.so
00007f92562c0000 16 12 12 rw--- [ anon ]
00007f92562c4000 92 72 0 r-x-- libpthread-2.12.so
00007f92562db000 2048 0 0 ----- libpthread-2.12.so
00007f92564db000 4 4 4 r---- libpthread-2.12.so
00007f92564dc000 4 4 4 rw--- libpthread-2.12.so
00007f92564dd000 16 4 4 rw--- [ anon ]
00007f92564e1000 88 44 0 r-x-- libgcc_s-4.4.7-20120601.so.1
00007f92564f7000 2044 0 0 ----- libgcc_s-4.4.7-20120601.so.1
00007f92566f6000 4 4 4 rw--- libgcc_s-4.4.7-20120601.so.1
00007f92566f7000 524 12 0 r-x-- libm-2.12.so
00007f925677a000 2044 0 0 ----- libm-2.12.so
00007f9256979000 4 4 4 r---- libm-2.12.so
00007f925697a000 4 4 4 rw--- libm-2.12.so
00007f925697b000 8 4 0 r-x-- libdl-2.12.so
00007f925697d000 2048 0 0 ----- libdl-2.12.so
00007f9256b7d000 4 4 4 r---- libdl-2.12.so
00007f9256b7e000 4 4 4 rw--- libdl-2.12.so
00007f9256b7f000 28 8 0 r-x-- librt-2.12.so
00007f9256b86000 2044 0 0 ----- librt-2.12.so
00007f9256d85000 4 4 4 r---- librt-2.12.so
00007f9256d86000 4 4 4 rw--- librt-2.12.so
00007f9256d87000 128 40 0 r-x-- ld-2.12.so
00007f9256e9b000 4 0 0 ----- [ anon ]
00007f9256e9c000 1024 24 24 rw--- [ anon ]
00007f9256f9c000 20 20 20 rw--- [ anon ]
00007f9256fa3000 4 0 0 rw--- [ anon ]
00007f9256fa4000 4 4 4 rw--- [ anon ]
00007f9256fa5000 4 0 0 rw--- [ anon ]
00007f9256fa6000 4 4 4 rw--- [ anon ]
00007f9256fa7000 4 4 4 r---- ld-2.12.so
00007f9256fa8000 4 4 4 rw--- ld-2.12.so
00007f9256fa9000 4 4 4 rw--- [ anon ]
00007f9256faa000 43872 4808 0 r-x-- mongod
00007f9259a83000 780 780 780 r---- mongod
00007f9259b46000 980 40 40 rw--- mongod
00007f9259c3b000 444 296 296 rw--- [ anon ]
00007f925af9e000 12288 12084 12084 rw--- [ anon ]
00007f925bb9e000 6464332 6224628 6224624 rw--- [ anon ]
00007ffd5da06000 136 48 48 rw--- [ stack ]
00007ffd5da89000 4 4 0 r-x-- [ anon ]
ffffffffff600000 4 0 0 r-x-- [ anon ]
---------------- ------ ------ ------
total kB 7924496 6245264 6239788
文章標(biāo)題:Linux/Centos查看進(jìn)程占用內(nèi)存大小的幾種方法總結(jié)-創(chuàng)新互聯(lián)
URL鏈接:http://jinyejixie.com/article4/dsijoe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、網(wǎng)站營銷、商城網(wǎng)站、關(guān)鍵詞優(yōu)化、全網(wǎng)營銷推廣、做網(wǎng)站
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源:
創(chuàng)新互聯(lián)