Strace all signals processes based on a name ( The processes already started... ) with bash built-in

straceprocessname(){ x=( $(pgrep "$@") ); [[ ${x[@]} ]] || return 1; strace -vf ${x[@]/#/-p }; }
Especially for sysadmins when they don't want to waste time to add -p flag on the N processes of a processname. In the old school, you did ; pgrep processname and typing strace -f -p 456 -p 678 -p 974... You can add -f argument to the function. That way, the function will deal with pgrep to match the command-line. Example : processname -f jrockit

3
By: sputnick
2009-12-03 00:04:39

1 Alternatives + Submit Alt

  • This one-liner will use strace to attach to all of the currently running apache processes output and piped from the initial "ps auxw" command into some awk. Show Sample Output


    7
    ps auxw | grep sbin/apache | awk '{print"-p " $2}' | xargs strace
    px · 2011-03-14 21:45:22 7

What Others Think

This function is all about signal processes in the program and I used that much time. I write my paper about this function and explain when you need to use it and when don't need to use it.
Ryan282 · 8 weeks and 4 days ago
The process of the code is easier for the person who has the knowledge of programming, but a person like me who has zero knowledge in coding will not understand the code character and the values. You can write time management essays so that it will helpful for the non-programmers. I know it is not easy, but you can do that.
Charles273 · 8 weeks and 4 days ago
Command lineuf is a website that has information of their window above Strace all signals processes based on a name. They have several functions to protect any private files so we should have to assign best assignment writers to collect more information about it. Join their website for more.
xokedo3427 · 8 weeks and 3 days ago
saveed · 7 weeks and 2 days ago
I can let them know about Strace all signals processes based on a name as that was what we all are up for the rest of the academic stuff. We can say that easy essay was what we all are up for the first time ever. You can see that and this was twhat we needed to go for.
saveed · 7 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: