PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 10372 696 588 S 0.0 0.1 0:00.81 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root 10 -5 0 0 0 S 0.0 0.0 0:01.79 events/0
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
14 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
18 root 10 -5 0 0 0 S 0.0 0.0 0:00.05 kblockd/0
19 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
(3)pgrep 根据特定条件筛选
-l PID连同进程名一起输出
-U 检索指定用户的进程
-t 检索指定终端的进程
[root@localhost ~]# pgrep -l-U root
1 init
2 migration/0
3 ksoftirqd/0
4 events/0
5 khelper
14 kthread
18 kblockd/0
………
(4)pstree 树状结构查看
-a 显示完整命令行
-u 列出各进程所属的用户名
-p 列出对应的PID号
2,如何管理进程:以xsnow为例
(1)安装此款软件
[root@localhost Desktop]# yumlocalinstall -y xsnow-1.42-10.i386.rpm --nogpgcheck
Loaded plugins: product-id, security,subscription-manager
This system is not registered to Red Hat SubscriptionManagement. You can use subscription-manager to register.
Setting up Local Package Process
Examining xsnow-1.42-10.i386.rpm: xsnow-1.42-10.i386
Marking xsnow-1.42-10.i386.rpm to be installed
Resolving Dependencies
--> Running transaction check
………………………………………
……………..
(2)打开软件,发现软件在前台运行时不能做其他任何操作
[root@localhost Desktop]# xsnow
Xsnow-1.42, December 14th 2001 by Rick Jansen(rja@euronet.nl)
WWW: http://www.euronet.nl/~rja/Xsnow/
(3)Ctrl+Z使当前运行停止并放置到后台,查看后台运行进程
[root@localhost ~]# xsnow
Xsnow-1.42, December 14th 2001 by Rick Jansen(rja@euronet.nl)
WWW: http://www.euronet.nl/~rja/Xsnow/
6,临时服务开启的两种方法 首先需要安装并打开xinetd托管服务
[root@localhost~]# rpm -qi xinetd
package xinetd is not installed
[root@localhost~]# yum install -y xinetd
Failedto set locale, defaulting to C
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
Settingup Install Process
ResolvingDependencies
-->Running transaction check
--->Package xinetd.x86_64 2:2.3.14-17.el5 set to be updated
-->Finished Dependency Resolution
………………………………………..
………………………….
[root@localhost~]# chkconfig --level 35 xinetd on
[root@localhost~]# chkconfig --list xinetd
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
(1)chkconfig 临时服务 on
[root@localhost ~]# chkconfig --list rsync
rsync off
[root@localhost ~]# chkconfig rsync on
[root@localhost ~]# chkconfig --list rsync
rsync on
(2)vim /etc/xinetd.d/临时服务
把 disable改为no
[root@localhost ~]# chkconfigrsync off
[root@localhost ~]# vim/etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition toan ftp server, as it \
# allowscrc checksumming etc.
service rsync
{
disable= no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
~
~
-- INSERT -- 6,14-21 All
[root@localhost ~]# chkconfig--list rsync
rsync on