相关疑难解决方法(0)

更优雅的"ps aux | grep -v grep"

当我检查进程列表并'grep'出我感兴趣的那些时,grep它本身也包含在结果中.例如,要列出终端:

$ ps aux  | grep terminal
user  2064  0.0  0.6 181452 26460 ?        Sl   Feb13   5:41 gnome-terminal --working-directory=..
user  2979  0.0  0.0   4192   796 pts/3    S+   11:07   0:00 grep --color=auto terminal
Run Code Online (Sandbox Code Playgroud)

通常我ps aux | grep something | grep -v grep用来摆脱最后一个条目......但它不优雅 :)

你有一个更优雅的黑客来解决这个问题(除了将所有命令包装到一个单独的脚本,这也不错)

linux grep

165
推荐指数
6
解决办法
17万
查看次数

标签 统计

grep ×1

linux ×1