Reputation: 459
I was wondering how I could reduce the amount of grep or pipes used in this command.
ps h -eo pid:1,uid,command | grep -v "screen" | grep java | grep -v "bash" | grep -v "grep"
Could it be reduced?
Upvotes: 3
Views: 73
Reputation: 185053
Is this fit your needs ?
ps h -eo pid:1,uid,command | grep -Ev "screen|bash" | grep '[j]ava'
[j]ava
is a known regex
trick to avoid using grep -v 'grep'
Upvotes: 2