原文链接:http://blog.chinaunix.net/u/12066/showart_485691.html
PIDOF(8) Linux System Administrator’s Manual PIDOF(8)
NAME
pidof -- find the process ID of a running program.
# 注释 :pidof 用于找出一个正在运行的程序的 PID
SYNOPSIS
pidof [-s] [-x] [-o omitpid] [-o omitpid..] program [program..]
DESCRIPTION
Pidof finds the process id’s (pids) of the named programs. It prints those id’s on the standard output. This program is on
some systems used in run-level change scripts, especially when the system has a System-V like rc structure. In that case
these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that
should be used instead.
# 注释 :pidof 找出给定名称的进程的 pid 并打印到 stdout 。
OPTIONS
-s Single shot - this instructs the program to only return one pid.
# 注释 :-s 表示只返回1个 pid
-x Scripts too - this causes the program to also return process id’s of shells running the named scripts.
# 注释 :-x 表示同时返回运行给定程序的 shell 的 pid
-o Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of
the pidof program, in other words the calling shell or shell script.
# 注释 :-o 表示告诉 piod 表示忽略后面给定的 pid ,可以使用多个 -o 。你可以用 %PPID 表示忽略 pidof 程序的父进程的 PID , 也就是调用 pidof 的 shell 或者脚本的 pid
NOTES
pidof is simply a (symbolic) link to the killall5 program, which should also be located in /sbin.
When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it
is possible that it returns pids of running programs that happen to have the same name as the program you’re after but are
actually other programs.
# 注释 :如果 是一个 fullpath 则 pidof 不会出错,但如果不是则有可能返回和给定 同名的程序
SEE ALSO
shutdown(8), init(8), halt(8), reboot(8)
AUTHOR
Miquel van Smoorenburg,
阅读(2256) | 评论(0) | 转发(0) |