我想使用top | grep user
了解有多少进程正在运行。
但是,在我运行 top | 之后grep user > temp_file
,命令一直在运行。
如何通过将信息写入 temp_file
来安全地停止它?
最佳答案
您可以使用 -n 1
选项到 top
使其只执行一次迭代。
可能更好的工具是 ps
,如 ps aux | grep 用户
.
关于linux - 如何退出 'loop' 的 'top | grep user' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53844153/