Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 2
    It's bad answer! Because if there was a word grep in your phrase. It will not show that process. For example, suppose a file called foo_grep_bar.txt is being edited by the nano command. So there's a process running: root 14908 0.0 0.0 110012 1692 pts / 3 S + Oct31 0:00 nano foo_grep_bar.txt According to this answer, this will not work: $ ps aux | grep nano | grep -v grep Because there's a grep word in your filename. Commented Oct 31, 2017 at 23:33
  • I prefer this as its more explicit about its intention than the accepted answer and works in all but one case. Commented Mar 28, 2018 at 11:20
  • 3
    as per superuser.com/a/409658/450260 you should be excluding the full grep fnord not just grep i.e. $ ps aux | grep fnord | grep -v "grep fnord" Commented Jul 26, 2018 at 7:22
  • 1
    Improved variation. Commented Oct 11, 2019 at 8:04
  • I like this answer best because people reading this don't have to wonder why in the world the grep requires brackets in the other case, it's not obvious at all unless you know why it's needed. This one is really clear. But both are great answers! Commented Aug 16, 2021 at 15:41