本文主要是介绍Linux命令之pidof,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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 [-o omitpid] [-o omitpid..]
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 the rc scripts found in the /etc/init.d directory.Notes
killall5 can also be invoked as pidof, which is simply a (symbolic) link to the killall5 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).
---------------------------------------我是分割线------------------------------------------------------
这篇关于Linux命令之pidof的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!