| 1 |
.\" |
| 2 |
.\" Copyright (c) 2018-2023 Jim Warner <[email protected]> |
| 3 |
.\" Copyright (c) 2019-2023 Craig Small <[email protected]> |
| 4 |
.\" Copyright (c) 2013 Jaromir Capik <[email protected]> |
| 5 |
.\" Copyright (c) 1998 Miquel van Smoorenburg |
| 6 |
.\" |
| 7 |
.\" This program is free software; you can redistribute it and/or modify |
| 8 |
.\" it under the terms of the GNU General Public License as published by |
| 9 |
.\" the Free Software Foundation; either version 2 of the License, or |
| 10 |
.\" (at your option) any later version. |
| 11 |
.\" |
| 12 |
.\" |
| 13 |
.TH PIDOF 1 2023-01-16 procps-ng |
| 14 |
.SH NAME |
| 15 |
pidof \- find the process ID of a running program |
| 16 |
.SH SYNOPSIS |
| 17 |
.B pidof |
| 18 |
.RB [ \-s ] |
| 19 |
.RB [ \-c ] |
| 20 |
.RB [ \-q ] |
| 21 |
.RB [ \-w ] |
| 22 |
.RB [ \-x ] |
| 23 |
.RB [ \-o |
| 24 |
.IR omitpid [,.\|.\|.\&]] |
| 25 |
\&.\|.\|.\& |
| 26 |
.RB [ \-t ] |
| 27 |
.RB [ \-S |
| 28 |
.IR separator ] |
| 29 |
.IR program " .\|.\|." |
| 30 |
.SH DESCRIPTION |
| 31 |
.B Pidof |
| 32 |
finds the process id's (pids) of the named programs. It prints those |
| 33 |
id's on the standard output. |
| 34 |
.SH OPTIONS |
| 35 |
.IP \fB\-s\fP |
| 36 |
Single shot - this instructs the program to only return one \fIpid\fP. |
| 37 |
.IP \fB\-c\fP |
| 38 |
Only return process ids that are running with the same root directory. |
| 39 |
This option is ignored for non-root users, as they will be unable to check |
| 40 |
the current root directory of processes they do not own. |
| 41 |
.IP \fB\-q\fP |
| 42 |
Quiet mode, suppress any output and only sets the exit status accordingly. |
| 43 |
.IP \fB\-w\fP |
| 44 |
Show also processes that do not have visible command line (e.g. kernel |
| 45 |
worker threads). |
| 46 |
.IP \fB\-x\fP |
| 47 |
Scripts too - this causes the program to also return process id's of |
| 48 |
shells running the named scripts. |
| 49 |
.IP "\fB-o\fP \fIomitpid\fP" |
| 50 |
Tells \fBpidof\fP to omit processes with that process id. The special |
| 51 |
pid \fB%PPID\fP can be used to name the parent process of the \fBpidof\fP |
| 52 |
program, in other words the calling shell or shell script. |
| 53 |
.IP \fB\-t\fP |
| 54 |
Shows all thread ids instead of pids. |
| 55 |
.IP "\fB-S\fP \fIseparator\fP" |
| 56 |
Use \fIseparator\fP as a separator put between pids. Used only when |
| 57 |
more than one pids are printed for the program. |
| 58 |
The \fB\-d\fR option is an alias for this option for sysvinit |
| 59 |
.B pidof |
| 60 |
compatibility. |
| 61 |
.SH "EXIT STATUS" |
| 62 |
.TP |
| 63 |
.B 0 |
| 64 |
At least one program was found with the requested name. |
| 65 |
.TP |
| 66 |
.B 1 |
| 67 |
No program was found with the requested name. |
| 68 |
.SH BUGS |
| 69 |
When using the \fB\-x\fP option, |
| 70 |
.B pidof |
| 71 |
only has a simple method for detecting scripts and will miss scripts that, |
| 72 |
for example, use env. This limitation is due to how the scripts look in |
| 73 |
the proc filesystem. |
| 74 |
.SH SEE ALSO |
| 75 |
.BR pgrep (1), |
| 76 |
.BR pkill (1) |
| 77 |
.SH AUTHOR |
| 78 |
.MT [email protected] |
| 79 |
Jaromir Capik |
| 80 |
.ME |