标签:
touch /var/log/pacct #创建记录所用的文件
accton /var/log/pacct #激活accton
accton #关闭accton
lastcomm -f /var/log/pacct #查看进程统计记录的文件
[aaa@localhost ~]$ ps
PID TTY TIME CMD
2064 pts/200:00:00 bash
2122 pts/200:00:00 ping
2123 pts/200:00:00 ps
[aaa@localhost ~]$ pstree
init─┬─NetworkManager
├─abrtd
├─acpid
├─atd
├─auditd───{auditd}
├─automount───4*[{automount}]
├─certmonger
├─crond
├─cupsd
├─dbus-daemon───{dbus-daemon}
├─hald─┬─hald-runner─┬─hald-addon-acpi
││└─hald-addon-inpu
│└─{hald}
├─master─┬─pickup
│└─qmgr
├─6*[mingetty]
├─modem-manager
├─ntpd
├─2*[ping]
├─rhsmcertd
├─rpc.statd
├─rpcbind
├─rsyslogd───3*[{rsyslogd}]
├─sshd───sshd───sshd───bash─┬─ping
│└─pstree
├─udevd───2*[udevd]
└─wpa_supplicant
kill 进程号
#如终止后台的ping进程
[aaa@localhost ~]$ ps
PID TTY TIME CMD
2064 pts/200:00:00 bash
2122 pts/200:00:00 ping
2168 pts/200:00:00 ps
[aaa@localhost ~]$ kill 2122
pgrep -l sshd #查询ssh的进程
标签:
原文地址:http://www.cnblogs.com/gzsl/p/385e3679da2bfc0e7c87caa9c94d0f0c.html