summaryrefslogtreecommitdiff
path: root/pidof.1
diff options
context:
space:
mode:
authorMasatake YAMATO <yamato@redhat.com>2018-02-24 18:03:11 +0900
committerCraig Small <csmall@enc.com.au>2018-03-02 21:48:23 +1100
commit7f5971058ae1a6241d03335e763a00f78da49737 (patch)
tree86535075938f08b157a548ada2ca8b3f658dc666 /pidof.1
parent1ddd17b17c99ba82af9a3758433f29bec3114802 (diff)
downloadprocps-ng-7f5971058ae1a6241d03335e763a00f78da49737.tar.gz
pidof: allow to change a separator put between pids
I frequency use pidof command with strace system call tracer. strace can trace MULTIPLE processes specified with "-p $PID" arguments like: strace -p 1 -p 1030 -p 3043 Sometimes I want to do as following strace -p $(pidof httpd) However, above command line doesn't work because -p option is needed for specifying a pid. pidof uses a whitespace as a separator. For passing the output to strace, the separator should be replaced with ' -p '. This maybe not a special to my use case. This commit introduces -S option that allows a user to specify a separator the one wants. $ ./pidof bash ./pidof bash 24624 18790 12786 11898 11546 10766 7654 5095 $ ./pidof -S ',' bash ./pidof -S ',' bash 24624,18790,12786,11898,11546,10766,7654,5095 $ ./pidof -S '-p ' bash ./pidof -S '-p ' bash 24624-p 18790-p 12786-p 11898-p 11546-p 10766-p 7654-p 5095 $ ./pidof -S ' -p ' bash ./pidof -S ' -p ' bash 24624 -p 18790 -p 12786 -p 11898 -p 11546 -p 10766 -p 7654 -p 5095 $ strace -p $(./pidof -S ' -p ' bash) strace -p $(./pidof -S ' -p ' bash) strace: Process 24624 attached strace: Process 18790 attached strace: Process 12786 attached ... Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Diffstat (limited to 'pidof.1')
-rw-r--r--pidof.15
1 files changed, 5 insertions, 0 deletions
diff --git a/pidof.1 b/pidof.1
index f49cd23..15b4031 100644
--- a/pidof.1
+++ b/pidof.1
@@ -27,6 +27,8 @@ pidof -- find the process ID of a running program.
.IR omitpid[,omitpid..] ]
.RB [ \-o
.IR omitpid[,omitpid..].. ]
+.RB [ \-S
+.IR separator ]
.B program
.RB [ program.. ]
.SH DESCRIPTION
@@ -47,6 +49,9 @@ shells running the named scripts.
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.
+.IP "-S \fIseparator\fP"
+Use \fIseparator\fP as a separator put between pids. Used only when
+more than one pids are printed for the program.
.SH "EXIT STATUS"
.TP
.B 0