linux 下监控进程流量情况命令 NetHogs

linux 下监控进程流量情况命令 NetHogs

 

NetHogs介绍

NetHogs是一款开源、免费的,终端下的网络流量监控工具,它可监控Linux的进程或应用程序的网络流量。NetHogs只能实时监控进程的网络带宽占用情况。NetHogs支持IPv4和IPv6协议,支持本地网卡以及PPP链接。

官方介绍如下:

NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to indentify programs that have gone wild and are suddenly taking up your bandwidth.

 

NetHogs下载

NetHogs的开源代码在sourceforge上提供下载,它只提供源代码下载。http://sourceforge.net/projects/nethogs/?source=directory。如果你需要下载RPM安装包,可以去这个网址下载

 

Ubuntu下NetHogs安装

sudo apt-get install nethogs

ReadHat下NetHogs安装

warning: nethogs-0.8.0-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
########################################### [100%]
########################################### [100%]
[root@localhost tmp]# 

clip_image001

  源码安装由于测试过程安装失败,再次不做讲述

 

NetHogs使用

 

[root@localhost tmp]# nethogs

clip_image002

NetHogs提供交互式控制指令:

m : Cycle between display modes (kb/s, kb, b, mb) 切换网速显示单位

r : Sort by received. 按接收流量排序

s : Sort by sent. 按发送流量排序

q : Quit and return to the shell prompt. 退出NetHogs命令工具

clip_image003

 

NetHogs 命令行参数

常用的参数:

-d delay for refresh rate. 数据刷新时间 如nethogs -d 1 就是每秒刷新一次

-h display available commands usage. 显示命名帮助、使用信息

-p sniff in promiscious mode (not recommended).

-t tracemode.

-V prints Version info.

演示例子:

nethogs eth0 -d 5

#5秒刷新一次数据

nethogs -d 5

#监控网卡eth0数据

nethogs eth0

#同时监视eth0和eth1接口

nethogs eth0 eth1

#将监控日志写入日志文件
nethogs >>test.log

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值