Linux命令之pidof

来源:互联网 发布:mac保存图片 编辑:程序博客网 时间:2024/05/16 05:01

pidof - 找出正在运行程序的进程PID

程序可以是一个二进制执行程序,

也可以是一个shell脚本。

如果是找出java程序的进程PID,pidof就无能为力了,可以使用ps -ef|grep java或jps -l来查看java进程的信息。

通常找出进程PID的目的是确认程序是否在运行、或者为了把它杀掉、或者发送一个信号给它。


参数:
-s 表示只返回1个 pid
-x 表示同时返回运行给定程序的 shell 的 pid
-o 表示告诉 piod 表示忽略后面给定的 pid ,可以使用多个 -o 。

-----------------------------------------------------------------------我是分割线-----------------------------------------------------------------

--killall5 -- send a signal to all processes.

killall5 -signalnumber [-oomitpid] [-oomitpid..]

Description

killall5 is the SystemV killall command. It sends a signal to all processes exceptkernel threads and the processes in its own session, so it won't kill the shell that is running the script it was called from. Its primary (only) use is in therc scripts found in the /etc/init.d directory.

Notes

killall5 can also be invoked as pidof, which is simply a (symbolic) link to thekillall5 program.

Exit Status

The program return zero if it killed processes.

It return 2 if no process were killed,

and 1 ifit was unable to find any processes (/proc/ is missing).


---------------------------------------我是分割线------------------------------------------------------


0 0
原创粉丝点击