1

I want get the same result when pressing u to filter by USER, but instead using the column COMMAND and of course, I need this live (I mean, updating constantly) ;)

I'm on Ubuntu.

  • 1
    You don't mention which OS you are using; MacOS and RHEL, for instance, use very different top implementations. I'll guess you are using the standard gnu/linux top that comes with "procps". I don't see a way to do it there, unfortunately. I took a quick glance at "atop" and "htop" and didn't see an obvious way in either of those either. A competent C programmer could probably add this pretty easily, though, especially if you kludge for a particular COMMAND. If you don't know C but know some other language, start poking around in /proc/; the standard linux top gets its info from there. – Dan Pritts Sep 10 '13 at 18:49
  • Thanks for your reply @DanPritts I edit my questions to specify the OS. –  Sep 10 '13 at 23:45

1 Answers1

1

How do you like this?

watch -n 1 "ps auxw | head -n 1; ps auxw | awk '\$11 ~ /bash/ { print \$0 }' | sort -k 3 -r -n"

Replace bash with the command you want to filter for.

Mark Wagner
  • 18,019
  • 2
  • 32
  • 47
  • Thanks a lot. Is not perfect cos I'm out of top command and don't have another filter and sort features live, still help me. –  Sep 11 '13 at 13:39