1.
一个很简单的命令,pgrep,可以迅速定位包含某个关键字的进程的pid;使用这个命令,再也不用ps aux 以后去对哪个进程的pid了 用法:
pgrep -l XXX
说明:
-l参数,可以显示出pid及进程名字;不加-l只显示pid,谁知道是什么进程的pid
举例:
# pgrep httpd
2092
2
ps - ef 能够查看所有的内容
如: UID PID PPID C STIME TTY TIME CMD root 1 0 0 14:40 ? 00:00:00 /sbin/init root 2 0 0 14:40 ? 00:00:00 [kthreadd] root 3 2 0 14:40 ? 00:00:00 [ksoftirqd/0] root 6 2 0 14:40 ? 00:00:00 [migration/0] root 7 2 0 14:40 ? 00:00:00 [watchdog/0] root 8 2 0 14:40 ? 00:00:00 [migration/1] root 10 2 0 14:40 ? 00:00:00 [ksoftirqd/1] root 12 2 0 14:40 ? 00:00:00 [watchdog/1] root 13 2 0 14:40 ? 00:00:00 [migration/2] root 15 2 0 14:40 ? 00:00:00 [ksoftirqd/2] root 16 2 0 14:40 ? 00:00:00 [watchdog/2]