A blog about things I do: Debian, Linux, Python, whatever
strace $(pgrep httpd | awk '{ print "-p " $1 }' | tr '\n' ' ')
For completeness' sake, you could also use:# pgrep httpd | sed 's/^/-p /' | xargs straceSeems a bit easier to read, IMHO. Though naturally not so cool! :)BTW, it seems xargs could use some sort of argument like "automatically prepend arguments with X". Would neatly make this sort of hack useless.
Also can be written as:strace $(printf -- '-p %s ' $(pgrep httpd) )Thanks for sharing :)
Orstrace -p$(pgrep -d\ -p httpd)
I usually use:for i in $(ps -eLf |grep NAME |awk '{print $4}'); do (strace -p $i 2>&1 &); done
Leo, you mean like this: pgrep httpd | xargs -i strace -p {}
For completeness' sake, you could also use:
ReplyDelete# pgrep httpd | sed 's/^/-p /' | xargs strace
Seems a bit easier to read, IMHO. Though naturally not so cool! :)
BTW, it seems xargs could use some sort of argument like "automatically prepend arguments with X". Would neatly make this sort of hack useless.
Also can be written as:
ReplyDeletestrace $(printf -- '-p %s ' $(pgrep httpd) )
Thanks for sharing :)
Or
ReplyDeletestrace -p$(pgrep -d\ -p httpd)
I usually use:
ReplyDeletefor i in $(ps -eLf |grep NAME |awk '{print $4}'); do (strace -p $i 2>&1 &); done
Leo, you mean like this:
ReplyDeletepgrep httpd | xargs -i strace -p {}