捕获日志文件中的nethogs输出 [英] Capture nethogs output in log file

查看:556
本文介绍了捕获日志文件中的nethogs输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查我的进程使用的网络带宽. 为此,我发现nethogs工具很有用.使用此工具,我可以看到哪个进程正在消耗网络带宽和进程行为. 但是,如何为我的进程从nethogs捕获数据并将其存储到日志文件中?

I want to check the network bandwidth used by my process. For this i found that nethogs tool is useful. Using this tool i can see which process is eating up a network bandwidth and process behaviour. But how do I capture data from nethogs for a my process and store it into log file ?

推荐答案

您可以使用以下命令捕获输出:

You can use this command to capture output:

nethogs -d 5 | sed 's/[^[:print:][:cntrl:]]//g' > output.txt

这篇关于捕获日志文件中的nethogs输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆