文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>top\ps命令详解

top\ps命令详解

时间:2006-07-31  来源:mengchr

<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"><title></title><meta name="GENERATOR" content="OpenOffice.org 2.0 (Linux)"><meta name="CREATED" content="20060730;21474800"><meta name="CHANGED" content="20060730;21515100"> <style> </style>

top 命令查看系统的资源状况
  load average 表示在过去的一段时间内有多少个进程企图独占CPU
  zombie 进程 :不是异常情况。一个进程从创建到结束在最后那一段时间遍是僵尸。留在内存中等待父进程取的东西便是僵尸。任何程序都有僵尸状态,它占用一点内存资源,仅 仅是表象而已不必害怕。如果程序有问题有机会遇见,解决大批量僵尸简单有效的办法是重起。kill是无任何效果的 stop模式:与sleep进程应区别,sleep会主动放弃cpu,而stop是被动放弃cpu ,例单步跟踪,stop(暂停)的进程是无法自己回到运行状态的。 cpu states : nice: 让出百分比       irq :中断处理占用
idle:空间占用百分比     iowait:输入输出等待(如果它很大说明外存有瓶颈,需要升级硬盘(SCSI))
  Mem: 内存情况  
      设计思想:把资源省下来不用便是浪费,如添加内存后free值会不变,buff值会增大。   判断物理内存够不够,看交换分区的使用状态。

[mx@m ~]$ top

top - 21:46:24 up 1 min, 2 users, load average: 1.62, 0.63, 0.23

Tasks: 95 total, 3 running, 91 sleeping, 0 stopped, 1 zombie

Cpu(s): 14.0% us, 1.0% sy, 0.0% ni, 85.0% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st

Mem: 507384k total, 346676k used, 160708k free, 25988k buffers

Swap: 1023992k total, 0k used, 1023992k free, 228324k cached

为撒子开机就暂用了那么多内存呢?还好没占有交换分区。

[root@m m]# top

top - 23:39:11 up  1:54,  2 users,  load average: 0.21, 0.32, 0.34
Tasks: 109 total,   4 running, 103 sleeping,   0 stopped,   2 zombie
Cpu(s):  9.3% us,  1.2% sy,  0.1% ni, 88.0% id,  1.4% wa,  0.0% hi,  0.0% si,  0.0% st
Mem:    507384k total,   496908k used,    10476k free,    10336k buffers
Swap:  1023992k total,        0k used,  1023992k free,   270904k cached

这是开了office\PDF\stardict\一个终端。为什么会占有那么多内存呢?原来好像没占有那么多

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

2185 mx 15 0 86704 16m 11m R 8.7 3.4 0:00.65 gnome-terminal

2007 root 15 0 31256 14m 6028 S 5.3 2.9 0:02.76 Xorg

2093 mx 15 0 33560 7680 6332 S 0.3 1.5 0:00.12 gnome-settings-

2107 mx 15 0 28548 9340 7428 S 0.3 1.8 0:00.27 metacity

2121 mx 15 0 110m 20m 13m S 0.3 4.1 0:00.50 nautilus

1 root 16 0 1996 680 584 S 0.0 0.1 0:00.60 init

2 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0

3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0

4 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0

5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper

6 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread

8 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/0

9 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid

110 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khubd

112 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod

173 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pdflush

174 root 15 0 0 0 0 S 0.0 0.0 0:00.00 pdflush

175 root 25 0 0 0 0 S 0.0 0.0 0:00.00 kswapd0

176 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0

321 root 15 0 0 0 0 S 0.0 0.0 0:00.00 pccardd

ps命令 列进程。列出所有进程
ps ax   :tty值为“?”是守护进程,叫deamon 无终端,大多系统服务是此进程,内核态进程是看不到的,例木马
看进程树,以树形方式现实进程列表敲 ps axf  
      init是1号进程,系统所有进程都是它派生的,杀不掉
ps axm   :会把线程列出来
在linux下进程和线程是统一的,是轻量级进程的两种方式。
ps axu :显示进程的详细状态。
      vsz:说此进程一共占用了多大物理内存。
      rss:请求常驻内存多少
终止进程:   kill pid     本质是协商退出!(并不是强制退出)
                        全:   kill -信号   pid
kill –KILL pid   是强制退出。

[mx@m ~]$ ps aux

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.1 0.1 1996 680 ? Ss 21:44 0:00 init [5]

root 2 0.0 0.0 0 0 ? SN 21:44 0:00 [ksoftirqd/0]

root 3 0.0 0.0 0 0 ? S 21:44 0:00 [watchdog/0]

root 4 0.0 0.0 0 0 ? S< 21:44 0:00 [events/0]

root 5 0.0 0.0 0 0 ? S< 21:44 0:00 [khelper]

root 6 0.0 0.0 0 0 ? S< 21:44 0:00 [kthread]

root 8 0.0 0.0 0 0 ? S< 21:44 0:00 [kblockd/0]

root 9 0.0 0.0 0 0 ? S< 21:44 0:00 [kacpid]

root 110 0.0 0.0 0 0 ? S< 21:44 0:00 [khubd]

root 112 0.0 0.0 0 0 ? S< 21:44 0:00 [kseriod]

root 173 0.0 0.0 0 0 ? S 21:44 0:00 [pdflush]

root 174 0.0 0.0 0 0 ? S 21:44 0:00 [pdflush]

root 175 0.0 0.0 0 0 ? S 21:44 0:00 [kswapd0]

root 176 0.0 0.0 0 0 ? S< 21:44 0:00 [aio/0]

root 321 0.0 0.0 0 0 ? S 21:44 0:00 [pccardd]

root 332 0.0 0.0 0 0 ? S< 21:44 0:00 [kpsmoused]

root 338 0.0 0.1 1952 672 ? Ss 21:44 0:00 /bin/nash /init rhgb

root 349 0.0 0.0 0 0 ? S< 21:44 0:00 [ata/0]

root 353 0.0 0.0 0 0 ? S< 21:44 0:00 [scsi_eh_0]

root 371 0.0 0.0 0 0 ? S< 21:44 0:00 [kjournald]

root 409 0.0 0.0 0 0 ? S< 21:44 0:00 [kauditd]

root 433 0.0 0.1 2216 688 ? S<s 21:44 0:00 /sbin/udevd -d

root 936 0.0 0.0 0 0 ? S 21:44 0:00 [khpsbpkt]

root 996 0.0 0.0 0 0 ? S< 21:44 0:00 [hda_codec]

root 1032 0.0 0.0 0 0 ? S 21:44 0:00 [knodemgrd_0]

root 1215 0.0 0.0 0 0 ? S< 21:44 0:00 [kmirrord]

root 1237 0.0 0.0 0 0 ? S< 21:44 0:00 [kjournald]

root 1239 0.0 0.0 0 0 ? S< 21:44 0:00 [kjournald]

root 1510 0.0 0.1 1656 592 ? Ss 21:45 0:00 syslogd -m 0

root 1513 0.0 0.0 1604 396 ? Ss 21:45 0:00 klogd -x

root 1545 0.0 0.1 4740 588 ? Ss 21:45 0:00 rpc.idmapd

dbus 1559 0.1 0.1 3076 988 ? Ss 21:45 0:00 dbus-daemon --system

root 1592 0.0 0.0 1820 460 ? Ss 21:45 0:00 /usr/bin/hidd --server

root 1675 0.0 0.1 1876 724 ? Ss 21:45 0:00 /usr/sbin/automount --timeouroot 1689 0.0 0.0 1920 472 ? S 21:45 0:00 /usr/sbin/smartd -q never

root 1698 0.0 0.0 1596 448 ? Ss 21:45 0:00 /usr/sbin/acpid

root 1716 0.0 0.3 8288 1896 ? Ss 21:45 0:00 sendmail: accepting connectismmsp 1724 0.0 0.3 7336 1700 ? Ss 21:45 0:00 sendmail: Queue runner@01:00root 1733 0.0 0.0 1824 344 ? Ss 21:45 0:00 gpm -m /dev/input/mice -t exroot 1745 0.0 0.2 6260 1108 ? Ss 21:45 0:00 crond

xfs 1779 0.0 0.3 3648 1668 ? Ss 21:45 0:00 xfs -droppriv -daemon

avahi 1843 0.0 0.2 2804 1452 ? Ss 21:45 0:00 avahi-daemon: running [m.locavahi 1844 0.0 0.0 2804 312 ? Ss 21:45 0:00 avahi-daemon: chroot helper

68 1853 0.4 0.6 5004 3336 ? Ss 21:45 0:01 hald

root 1854 0.0 0.2 3136 1020 ? S 21:45 0:00 hald-runner

68 1860 0.0 0.1 2232 868 ? S 21:45 0:00 /usr/libexec/hald-addon-acpi68 1865 0.0 0.1 2232 872 ? S 21:45 0:00 /usr/libexec/hald-addon-keybroot 1892 0.0 0.1 2196 704 ? D 21:45 0:00 /usr/libexec/hald-addon-storroot 1908 0.0 0.0 1588 408 tty1 Ss+ 21:45 0:00 /sbin/mingetty tty1

root 1911 0.0 0.0 1588 404 tty2 Ss+ 21:45 0:00 /sbin/mingetty tty2

root 1914 0.0 0.0 1584 404 tty3 Ss+ 21:45 0:00 /sbin/mingetty tty3

root 1917 0.0 0.0 1588 408 tty4 Ss+ 21:45 0:00 /sbin/mingetty tty4

root 1920 0.0 0.0 1584 404 tty5 Ss+ 21:45 0:00 /sbin/mingetty tty5

root 1923 0.0 0.0 1584 404 tty6 Ss+ 21:45 0:00 /sbin/mingetty tty6

root 1926 0.0 0.2 5732 1264 ? Ss 21:45 0:00 /bin/sh /etc/X11/prefdm -nodroot 1931 0.0 0.4 14020 2524 ? S 21:45 0:00 /usr/sbin/gdm-binary -nodaemroot 2004 0.0 0.5 14644 2756 ? S 21:45 0:00 /usr/sbin/gdm-binary -nodaemroot 2007 4.3 3.2 24388 16312 tty7 Ss+ 21:45 0:11 /usr/bin/Xorg :0 -audit 0 -amx 2032 0.0 1.8 23844 9508 ? Ss 21:45 0:00 /usr/bin/gnome-session

mx 2054 0.0 0.0 0 0 ? Z 21:45 0:00 [Xsession] <defunct>

mx 2075 0.0 0.1 4096 676 ? Ss 21:45 0:00 /usr/bin/ssh-agent /usr/bin/mx 2078 0.0 0.0 2896 492 ? S 21:45 0:00 /usr/bin/dbus-launch --exit-mx 2079 0.0 0.2 3072 1184 ? Ss 21:45 0:00 dbus-daemon --fork --print-pmx 2085 0.1 0.6 8160 3368 ? S 21:45 0:00 /usr/libexec/gconfd-2 5

mx 2089 0.0 0.1 2308 532 ? S 21:45 0:00 /usr/bin/gnome-keyring-daemomx 2091 0.0 0.5 8596 2728 ? Ss 21:45 0:00 /usr/libexec/bonobo-activatimx 2093 0.0 1.5 33560 7680 ? Sl 21:45 0:00 /usr/libexec/gnome-settings-mx 2098 0.0 0.2 3096 1376 ? Ss 21:45 0:00 /usr/bin/esd -terminate -nobmx 2107 0.2 1.8 28548 9372 ? Ss 21:45 0:00 /usr/bin/metacity --sm-clienmx 2109 0.0 1.2 23452 6240 ? Ss 21:45 0:00 gnome-power-manager

mx 2119 0.2 3.0 72012 15344 ? Ssl 21:45 0:00 gnome-panel --sm-client-id dmx 2121 0.2 3.6 110560 18536 ? Ssl 21:45 0:00 nautilus --no-default-windowmx 2124 0.0 1.7 24120 9040 ? Ss 21:45 0:00 /usr/lib/scim-1.0/scim-launcmx 2127 0.0 1.6 44516 8156 ? Ss 21:45 0:00 eggcups --sm-client-id defaumx 2129 0.0 0.7 16036 3580 ? Ss 21:45 0:00 bluez-pin --dbus

mx 2130 0.0 1.0 22420 5420 ? Ss 21:45 0:00 gnome-volume-manager --sm-clmx 2133 0.0 0.7 12676 3880 ? Sl 21:45 0:00 /usr/libexec/gnome-vfs-daemomx 2139 0.1 2.5 71036 12824 ? S 21:45 0:00 /usr/libexec/wnck-applet --omx 2145 0.0 1.6 79724 8328 ? Sl 21:45 0:00 /usr/libexec/trashapplet --omx 2147 0.0 1.9 49136 9992 ? Ss 21:45 0:00 nm-applet --sm-disable

mx 2153 0.0 0.8 15332 4492 ? Ss 21:45 0:00 pam-panel-icon --sm-client-iroot 2161 0.0 0.1 1768 616 ? S 21:45 0:00 /sbin/pam_timestamp_check -dmx 2169 0.0 0.0 7100 492 ? Ss 21:45 0:00 /usr/lib/scim-1.0/scim-helpemx 2170 0.0 1.4 48108 7316 ? Ssl 21:45 0:00 /usr/lib/scim-1.0/scim-panelmx 2172 0.0 0.2 15204 1032 ? Ss 21:45 0:00 /usr/lib/scim-1.0/scim-launcmx 2174 0.0 0.1 2316 988 ? S 21:45 0:00 /usr/libexec/gam_server

mx 2177 0.0 0.1 2216 764 ? S 21:45 0:00 /usr/libexec/mapping-daemon

mx 2179 0.1 3.2 77568 16448 ? S 21:45 0:00 /usr/libexec/mixer_applet2 -mx 2181 0.0 1.4 22856 7536 ? S 21:45 0:00 /usr/libexec/notification-armx 2183 0.0 1.8 26876 9552 ? S 21:45 0:00 /usr/libexec/clock-applet --mx 2185 1.4 3.5 112608 18196 ? Sl 21:46 0:03 gnome-terminal

mx 2187 0.0 0.1 2228 612 ? S 21:46 0:00 gnome-pty-helper

mx 2188 0.0 0.2 5736 1508 pts/1 Ss 21:46 0:00 bash

mx 2208 0.0 0.2 14952 1340 ? Ss 21:46 0:00 gnome-screensaver

mx 2212 0.0 0.2 5684 1068 ? S 21:46 0:00 /bin/sh /usr/lib/openoffice.mx 2222 1.5 11.6 234428 59036 ? Sl 21:46 0:02 /usr/lib/openoffice.org2.0/pmx 2247 0.0 0.1 5260 956 pts/1 R+ 21:49 0:00 ps aux

[mx@m ~]$


显示完整路径 [root@m en]# ps aux |grep bash mx 2147 0.0 0.2 5736 1512 pts/1 Ss 21:09 0:00 bash root 2282 0.0 0.3 5872 1536 pts/1 S 21:20 0:00 bash root 2445 0.0 0.1 5204 680 pts/1 R+ 21:42 0:00 grep bash [root@m en]# ps aufx |grep bash mx 2147 0.0 0.2 5736 1512 pts/1 Ss 21:09 0:00 \_ bash root 2282 0.0 0.3 5872 1536 pts/1 S 21:20 0:00 \_ bash root 2448 0.0 0.1 5200 676 pts/1 S+ 21:42 0:00 \_ grep bash [root@m en]#
相关阅读 更多 +
排行榜 更多 +
我的宠物医生世界

我的宠物医生世界

休闲益智 下载
恐怖的小丑最新版

恐怖的小丑最新版

休闲益智 下载
蛋糕赛道

蛋糕赛道

休闲益智 下载