docs: mention long options in man pgrep.1

This commit includes generic manual clean ups as well.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-09-27 22:42:51 +02:00
parent 7af14af685
commit 3a21ef5580

257
pgrep.1
View File

@ -2,162 +2,203 @@
.\" Licensed under version 2 of the GNU General Public License. .\" Licensed under version 2 of the GNU General Public License.
.\" Copyright 2000 Kjetil Torgrim Homme .\" Copyright 2000 Kjetil Torgrim Homme
.\" .\"
.TH PGREP 1 "October 5, 2007" "Linux" "Linux User's Manual" .TH PGREP "1" "September 2011" "procps-ng" "User Commands"
.SH NAME .SH NAME
pgrep, pkill \- look up or signal processes based on name and other attributes pgrep, pkill \- look up or signal processes based on name and other attributes
.SH SYNOPSIS .SH SYNOPSIS
.na .B pgrep
\fBpgrep\fR [\fB\-cflvx\fR] [\fB\-d\ \fIdelimiter\fR] [\fB\-n\fR|\fB\-o\fR] \ [options] pattern
[\fB\-P\ \fIppid\fR,...] [\fB\-g\ \fIpgrp\fR,...] [\fB\-s\ \fIsid\fR,...] \ .br
[\fB\-u\ \fIeuid\fR,...] [\fB\-U\ \fIuid\fR,...] [\fB\-G\ \fIgid\fR,...] \ .B pkill
[\fB\-t\ \fIterm\fR,...] [\fIpattern\fR] [options] pattern
.HP
\fBpkill\fR [\fB\-\fIsignal\fR] [\fB\-fvx\fR] [\fB\-n\fR|\fB\-o\fR] \
[\fB\-P\ \fIppid\fR,...] [\fB\-g\ \fIpgrp\fR,...] [\fB\-s\ \fIsid\fR,...] \
[\fB\-u\ \fIeuid\fR,...] [\fB\-U\ \fIuid\fR,...] [\fB\-G\ \fIgid\fR,...] \
[\fB\-t\ \fIterm\fR,...] [\fIpattern\fR]
.SH DESCRIPTION .SH DESCRIPTION
\fBpgrep\fP looks through the currently running processes and lists the .B pgrep
process IDs which matches the selection criteria to stdout. All looks through the currently running processes and lists the process IDs which
the criteria have to match. For example, matches the selection criteria to stdout. All the criteria have to match.
For example,
.IP .IP
$ pgrep \-u root sshd $ pgrep \-u root sshd
.PP .PP
will only list the processes called \fBsshd\fP AND owned by \fBroot\fP. will only list the processes called
.B sshd
AND owned by
.BR root .
On the other hand, On the other hand,
.IP .IP
$ pgrep \-u root,daemon $ pgrep \-u root,daemon
.PP .PP
will list the processes owned by \fBroot\fP OR \fBdaemon\fP. will list the processes owned by
.B root
\fBpkill\fP will send the specified signal (by default \fBSIGTERM\fP) OR
.BR daemon .
.PP
.B pkill
will send the specified signal (by default
.BR SIGTERM )
to each process instead of listing them on stdout. to each process instead of listing them on stdout.
.SH OPTIONS .SH OPTIONS
\-c .TP
\fB\-\fR\fIsignal\fP
.TQ
\fB\-\-signal\fR \fIsignal\fR
Defines the signal to send to each matched process. Either the numeric or
the symbolic signal name can be used.
.RB ( pkill
only.)
.TP
\fB\-c\fR, \fB\-\-count\fR
Suppress normal output; instead print a count of matching processes. Suppress normal output; instead print a count of matching processes.
(\fBpgrep\fP only.)
.TP .TP
\fB\-d \fIdelimiter\fP \fB\-d\fR, \fB\-\-delimeter\fR \fIdelimiter\fP
Sets the string used to delimit each process ID in the output (by Sets the string used to delimit each process ID in the output (by default a
default a newline). (\fBpgrep\fP only.) newline).
.RB ( pgrep
only.)
.TP .TP
\fB\-f\fR \fB\-f\fR, \fB\-\-full\fR
The \fIpattern\fP is normally only matched against the process name. The
When \fB\-f\fR is set, the full command line is used. .I pattern
is normally only matched against the process name. When
.B \-f
is set, the full command line is used.
.TP .TP
\fB\-g \fIpgrp\fP,... \fB\-g\fR, \fB\-\-pgroup\fR \fIpgrp\fP,...
Only match processes in the process group IDs listed. Process group 0 Only match processes in the process group IDs listed. Process group 0 is
is translated into \fBpgrep\fP's or \fBpkill\fP's own process group. translated into
.BR pgrep 's
or
.BR pkill 's
own process group.
.TP .TP
\-G \fIgid\fP,... \fB\-G\fR, \fB\-\-group\fR \fIgid\fP,...
Only match processes whose real group ID is listed. Either the Only match processes whose real group ID is listed. Either the numerical or
numerical or symbolical value may be used. symbolical value may be used.
.TP .TP
\fB\-l\fR \fB\-l\fR, \fB\-\-\fRlist\-name\fR
List the process name as well as the process ID. (\fBpgrep\fP only.) List the process name as well as the process ID.
.RB ( pgrep
only.)
\fB\-n\fR, \fB\-\-newest\fR
Select only the newest (most recently started) of the matching processes.
.TP .TP
\fB\-n\fR \fB\-o\fR, \fB\-\-oldest\fR
Select only the newest (most recently started) of the matching Select only the oldest (least recently started) of the matching processes.
processes.
.TP .TP
\fB\-o\fR \fB\-P\fR, \fB\-\-parent\fR \fIppid\fP,...
Select only the oldest (least recently started) of the matching
processes.
.TP
\fB\-P \fIppid\fP,...
Only match processes whose parent process ID is listed. Only match processes whose parent process ID is listed.
.TP .TP
\fB\-s \fIsid\fP,... \fB\-s\fR, \fB\-\-session\fR \fIsid\fP,...
Only match processes whose process session ID is listed. Session ID 0 Only match processes whose process session ID is listed. Session ID 0
is translated into \fBpgrep\fP's or \fBpkill\fP's own session ID. is translated into
.BR pgrep 's
or
.BR pkill 's
own session ID.
.TP .TP
\fB\-t \fIterm\fP,... \fB\-t\fR, \fB\-\-terminal\fR \fIterm\fP,...
Only match processes whose controlling terminal is listed. The Only match processes whose controlling terminal is listed. The terminal name
terminal name should be specified without the "/dev/" prefix. should be specified without the "/dev/" prefix.
.TP .TP
\fB\-u \fIeuid\fP,... \fB\-u\fR, \fB\-\-euid\fR \fIeuid\fP,...
Only match processes whose effective user ID is listed. Either the Only match processes whose effective user ID is listed. Either the numerical
numerical or symbolical value may be used. or symbolical value may be used.
.TP .TP
\fB\-U \fIuid\fP,... \fB\-U\fR, \fB\-\-uid\fR \fIuid\fP,...
Only match processes whose real user ID is listed. Either the Only match processes whose real user ID is listed. Either the numerical or
numerical or symbolical value may be used. symbolical value may be used.
.TP .TP
\fB\-v\fR \fB\-v\fR, \fB\-\-inverse\fR\fR
Negates the matching. Negates the matching.
.TP .TP
\fB\-x\fR \fB\-x\fR, \fB\-\-exact\fR\fR
Only match processes whose name (or command line if \-f is specified) Only match processes whose name (or command line if \-f is specified)
\fBexactly\fP match the \fIpattern\fP. .B exactly
match the
.IR pattern .
.TP .TP
\-\fIsignal\fP \fB\-F\fR, \fB\-\-pidfile\fR \fIfile\fR
Defines the signal to send to each matched process. Either the Read
numeric or the symbolic signal name can be used. (\fBpkill\fP only.) .IR PID 's
from file. This option is perhaps more useful for
.B pkill
than
.BR pgrep .
.TP
\fB\-L\fR, \fB\-\-logpidfile\fR
Fail if pidfile (see -F) not locked.
.TP
\fB\-V\fR, \fB\-\-version\fR
Display version information and exit.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display help and exit.
.PD
.SH OPERANDS .SH OPERANDS
.TP .TP
\fIpattern\fP .I pattern
Specifies an Extended Regular Expression for matching against the Specifies an Extended Regular Expression for matching against the process
process names or command lines. names or command lines.
.SH EXAMPLES .SH EXAMPLES
Example 1: Find the process ID of the \fBnamed\fP daemon: Example 1: Find the process ID of the
.B named
daemon:
.IP .IP
$ pgrep \-u root named $ pgrep \-u root named
.PP .PP
Example 2: Make \fBsyslog\fP reread its configuration file: Example 2: Make
.B syslog
reread its configuration file:
.IP .IP
$ pkill \-HUP syslogd $ pkill \-HUP syslogd
.PP .PP
Example 3: Give detailed information on all \fBxterm\fP processes: Example 3: Give detailed information on all
.B xterm
processes:
.IP .IP
$ ps \-fp $(pgrep \-d, \-x xterm) $ ps \-fp $(pgrep \-d, \-x xterm)
.PP .PP
Example 4: Make all \fBnetscape\fP processes run nicer: Example 4: Make all
.B netscape
processes run nicer:
.IP .IP
$ renice +4 `pgrep netscape` $ renice +4 $(pgrep netscape)
.SH "EXIT STATUS" .SH "EXIT STATUS"
.PD 0 .PD 0
.TP .TP
.I 0 0
One or more processes matched the criteria. One or more processes matched the criteria.
.TP .TP
.I 1 1
No processes matched. No processes matched.
.TP .TP
.I 2 2
Syntax error in the command line. Syntax error in the command line.
.TP .TP
.I 3 3
Fatal error: out of memory etc. Fatal error: out of memory etc.
.PD
.SH NOTES .SH NOTES
The process name used for matching is limited to the 15 characters The process name used for matching is limited to the 15 characters present in
present in the output of /proc/\fIpid\fP/stat. Use the \-f option to the output of /proc/\fIpid\fP/stat. Use the \-f option to match against the
match against the complete command line, /proc/\fIpid\fP/cmdline. complete command line, /proc/\fIpid\fP/cmdline.
.PP
The running \fBpgrep\fP or \fBpkill\fP process will never report The running
itself as a match. .B pgrep
or
.B pkill
process will never report itself as a
match.
.SH BUGS .SH BUGS
The options \fB\-n\fP and \fB\-o\fP and \fB\-v\fP can not be combined. The options
Let me know if you need to do this. .B \-n
and
.B \-o
and
.B \-v
can not be combined. Let
me know if you need to do this.
.PP
Defunct processes are reported. Defunct processes are reported.
.SH "SEE ALSO" .SH "SEE ALSO"
@ -168,12 +209,16 @@ Defunct processes are reported.
.BR skill (1), .BR skill (1),
.BR kill (1), .BR kill (1),
.BR kill (2) .BR kill (2)
.SH STANDARDS .SH STANDARDS
\fBpkill\fP and \fBpgrep\fP were introduced in Sun's Solaris 7. This .B pkill
implementation is fully compatible. and
.B pgrep
were introduced in Sun's Solaris 7. This implementation is fully compatible.
.SH AUTHOR .SH AUTHOR
Kjetil Torgrim Homme <kjetilho@ifi.uio.no> .UR kjetilho\@ifi.uio.no
Kjetil Torgrim Homme
Please send bug reports to <procps@freelists.org> .UE
.SH "REPORTING BUGS"
Please send bug reports to
.UR procps\@freelists.org
.UE