Find the process you are looking for minus the grepped one

ps aux | grep process-name | grep -v "grep"

-4
By: pavanlimo
2009-08-13 04:40:16

9 Alternatives + Submit Alt

What Others Think

Added this command just so it is searchable for newbies/beginners
pavanlimo · 462 weeks ago
Alternatively you can use the -c argument to ps ps auxc | grep process-name
tweakold · 462 weeks ago
Oh nice one guys! I have been putting up with this for years and years now. So good to read this. Still don't follow how olorin's example works though :(
DaveQB · 461 weeks and 6 days ago
@DaveQB: The grep searches for something that starts with a letter out of the list in brackets (which is just the letter p) and then rocess-name. So it will find anything with "process-name" in its command line, but won't find "grep [p]rocess-name" itself, as the brackets prevent grep from finding it (it doesn't start with p, followed by rocess-name, but with bracket, p, bracket, ...).
olorin · 461 weeks and 6 days ago
Simply awesome! :) Thanks
DaveQB · 461 weeks and 6 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: