2009-09-10 13:58:49 +05:30
|
|
|
'\" -*- coding: UTF-8 -*-
|
|
|
|
.\" Copyright (C) 1998 Miquel van Smoorenburg.
|
|
|
|
.\"
|
|
|
|
.\" This program is free software; you can redistribute it and/or modify
|
|
|
|
.\" it under the terms of the GNU General Public License as published by
|
|
|
|
.\" the Free Software Foundation; either version 2 of the License, or
|
|
|
|
.\" (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" This program is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public License
|
|
|
|
.\" along with this program; if not, write to the Free Software
|
|
|
|
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
.\"
|
|
|
|
.TH PIDOF 8 "01 Sep 1998" "" "Linux System Administrator's Manual"
|
|
|
|
.SH NAME
|
|
|
|
pidof -- find the process ID of a running program.
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B pidof
|
|
|
|
.RB [ \-s ]
|
|
|
|
.RB [ \-c ]
|
2010-02-23 22:21:18 +05:30
|
|
|
.RB [ \-n ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.RB [ \-x ]
|
|
|
|
.RB [ \-o
|
2018-11-11 06:57:11 +05:30
|
|
|
.IR omitpid[,omitpid...] ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.RB [ \-o
|
2018-11-11 06:57:11 +05:30
|
|
|
.IR omitpid[,omitpid...]... ]
|
|
|
|
.RB [ \-f
|
|
|
|
.IR format ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.B program
|
2018-11-11 06:57:11 +05:30
|
|
|
.RB [ program... ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.SH DESCRIPTION
|
|
|
|
.B Pidof
|
2018-09-09 01:49:21 +05:30
|
|
|
finds the process id's (PIDs) of the named programs. It prints those
|
2009-09-10 13:58:49 +05:30
|
|
|
id's on the standard output. This program is on some systems used in
|
|
|
|
run-level change scripts, especially when the system has a
|
|
|
|
\fISystem-V\fP like \fIrc\fP structure. In that case these scripts are
|
|
|
|
located in /etc/rc?.d, where ? is the runlevel. If the system has
|
|
|
|
a
|
|
|
|
.B start-stop-daemon
|
|
|
|
(8) program that should be used instead.
|
|
|
|
.SH OPTIONS
|
2010-02-23 22:21:18 +05:30
|
|
|
.IP \-s
|
2009-09-10 13:58:49 +05:30
|
|
|
Single shot - this instructs the program to only return one \fIpid\fP.
|
2010-02-23 22:21:18 +05:30
|
|
|
.IP \-c
|
2018-09-09 01:49:21 +05:30
|
|
|
Only return process PIDs that are running with the same root directory.
|
2009-09-10 13:58:49 +05:30
|
|
|
This option is ignored for non-root users, as they will be unable to check
|
|
|
|
the current root directory of processes they do not own.
|
2010-02-23 22:21:18 +05:30
|
|
|
.IP \-n
|
|
|
|
Avoid
|
|
|
|
.BR stat (2)
|
|
|
|
system function call on all binaries which are located on network
|
|
|
|
based file systems like
|
|
|
|
.BR NFS .
|
2018-11-11 06:57:11 +05:30
|
|
|
Instead of using this option the variable
|
2010-02-23 22:21:18 +05:30
|
|
|
.B PIDOF_NETFS
|
|
|
|
may be set and exported.
|
2018-09-09 01:49:21 +05:30
|
|
|
.IP \-q
|
|
|
|
Do not display matched PIDs to standard out. Simply exit with
|
|
|
|
a status of true or false to indicate whether a matching PID was found.
|
2010-02-23 22:21:18 +05:30
|
|
|
.IP \-x
|
2009-09-10 13:58:49 +05:30
|
|
|
Scripts too - this causes the program to also return process id's of
|
|
|
|
shells running the named scripts.
|
|
|
|
.IP "-o \fIomitpid\fP"
|
|
|
|
Tells \fIpidof\fP to omit processes with that process id. The special
|
|
|
|
pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
|
|
|
|
program, in other words the calling shell or shell script.
|
2018-11-11 06:57:11 +05:30
|
|
|
.IP "-f \fIformat\fP"
|
|
|
|
Tells \fIpidof\fP to format the process ids in the given \fIprintf\fP style.
|
|
|
|
For example \fB" -p%d"\fP is useful for \fIstrace\fP.
|
2009-09-10 13:58:49 +05:30
|
|
|
.SH "EXIT STATUS"
|
|
|
|
.TP
|
|
|
|
.B 0
|
|
|
|
At least one program was found with the requested name.
|
|
|
|
.TP
|
|
|
|
.B 1
|
|
|
|
No program was found with the requested name.
|
|
|
|
.SH NOTES
|
|
|
|
\fIpidof\fP is actually the same program as \fIkillall5\fP;
|
|
|
|
the program behaves according to the name under which it is called.
|
|
|
|
.PP
|
|
|
|
When \fIpidof\fP is invoked with a full pathname to the program it
|
|
|
|
should find the pid of, it is reasonably safe. Otherwise it is possible
|
2018-09-09 01:49:21 +05:30
|
|
|
that it returns PIDs of running programs that happen to have the same name
|
2018-11-11 06:57:11 +05:30
|
|
|
as the program you're after but are actually other programs. Note
|
2010-03-23 20:07:01 +05:30
|
|
|
that the executable name of running processes is calculated with
|
|
|
|
.BR readlink (2),
|
|
|
|
so symbolic links to executables will also match.
|
|
|
|
|
2009-09-10 13:58:49 +05:30
|
|
|
.SH SEE ALSO
|
|
|
|
.BR shutdown (8),
|
|
|
|
.BR init (8),
|
|
|
|
.BR halt (8),
|
|
|
|
.BR reboot (8),
|
|
|
|
.BR killall5 (8)
|
|
|
|
.SH AUTHOR
|
|
|
|
Miquel van Smoorenburg, miquels@cistron.nl
|