前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Linux下 查看 每个进程占用的网络带宽 - NetHogs

Linux下 查看 每个进程占用的网络带宽 - NetHogs

作者头像
xuyaowen
发布2021-12-02 21:18:35
6.4K0
发布2021-12-02 21:18:35
举报
文章被收录于专栏:XUYAOWEN的专栏XUYAOWEN的专栏

今天在服务器上进行测试程序,发现网速占用比较大,但不是我的程序。可能是其他同学在下载或者上传数据,所以需要看到底是哪个进程。

这时候使用 iftop, vnstat 等命令不能看出具体是哪个进程占用,因为它们常用来统计和监控网卡流量。通过搜索发现,NetHogs 可以满足我的需求;

具体界面如下:

下面简要记录一些程序相关的信息,方便之后回顾。

安装:

代码语言:javascript
复制
apt install nethogs

程序说明:(其中有一些可以交互的操作)

代码语言:javascript
复制
NAME
       nethogs - Net top tool grouping bandwidth per process

SYNOPSIS
       nethogs [-h] [-V] [-d] [-v] [-t] [-c] [-p] [-s] [device(s)]

DESCRIPTION
       NetHogs  is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet,
       like most such tools do, it groups bandwidth by process - and does not rely on a special kernel module to be loaded.
       So if there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this, 
       and if it's some kind of spinning process, kill it.

   Options
       -h     display available commands usage.

       -V     prints Version info.

       -d     delay for refresh rate.

       -v     select view mode

       -p     sniff in promiscious mode (not recommended).

       -t     tracemode.

       -c     limit number of refreshes

       -s     sort by traffic sent

       device(s) to monitor. By default eth0 is being used.

INTERACTIVE CONTROL
       m      cycle between display modes (kb/s, kb, b, mb)

       r      sort by 'received'

       s      sort by 'sent'

       q      quit

SEE ALSO
       netstat(8) tcpdump(1) pcap(3)

参考链接:https://www.cnblogs.com/carbon3/p/5930803.html

https://github.com/yaowenxu

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-12-01 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档