将顶部数据导出到文件
因此,我一直在尝试运行以下命令,以通过Firefox过程检查消费。
顶部-b | Grep“ Firefox”
现在我可以看到终端中所需的输出。但是现在,当我尝试将其导出到文件时,我无法。 我正在运行的命令是:
top -b | grep“ firefox”>>文件名
或top -B | grep“ firefox”>文件名
请提供帮助。
So I've been trying to run the following command to check the consumption by the firefox process.
top -b | grep "firefox"
Now I can see the desired output in terminal for it. But now when I try to export it to a file, I'm not able to.
The command I'm running is:
top -b | grep "firefox" >> filename
or top -b | grep "firefox" > filename
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要
-n
parmtop
。例如,没有
-n 1
top
将继续处理,并且永远不会将其纳入grep
。从
top
的人页面上:带有
while
循环的代码。除非您使用,否则它将永远循环类似
cntr
变量。如果需要,请删除CNTR
代码连续监视:
You need the
-n
parm fortop
. For example,Without
-n 1
top
will keep processing and will never make it togrep
..From the man page for
top
:Updated code with a
while
loop. It will loop forever unless you usesomething like
cntr
variable. Remove thecntr
code if you wantcontinuous monitoring:
您必须添加命令flag -n
更改要显示的过程数量。将提示您输入该号码。
要在Top Utility中使用特定过程的快照,请使用PID(-P)标志执行命令。
You have to add in the command the flag -n
Change the number of processes to show. You will be prompted to enter the number.
To take a snapshot of a specific process in top utility, execute command with the PID (-p) flag.