Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何减少此命令中使用的 grep 或管道的数量。
ps h -eo pid:1,uid,command | grep -v "screen" | grep java | grep -v "bash" | grep -v "grep"
可以减少吗?
这符合您的需求吗?
ps h -eo pid:1,uid,command | grep -Ev "screen|bash" | grep '[j]ava'
[j]ava
regex
grep -v 'grep'