nethogs使用

1、nethogs中的选项-t (追踪模式)在控制台定时刷新各进程的收发带宽,使用管道命令>即可实现输出重定向,完整命令“./nethogs –t –d 5”//-d 5表示每隔5s刷新一次。(教训:完全没必要添加Line::toString(),浪费1天时间,自身带有的参数-t)

 

2、查看使用“apt-get install 软件名”安装的软件(实际上在ubuntu下是可执行文件)存在的位置

root@f49:/bin# dpkg -L nethogs

/.

/usr

/usr/sbin

/usr/sbin/nethogs

/usr/share

/usr/share/doc

/usr/share/doc/nethogs

/usr/share/doc/nethogs/copyright

/usr/share/doc/nethogs/changelog.Debian.gz

/usr/share/doc/nethogs/README.md

/usr/share/man

/usr/share/man/man8

/usr/share/man/man8/nethogs.8.gz

 

清除已经安装的软件

root@f49:/usr/sbin# apt-get purge nethogs

Reading package lists... Done

Building dependency tree      

Reading state information... Done

The following package was automaticallyinstalled and is no longer required:

 linux-image-extra-4.4.0-51-generic

Use 'apt autoremove' to remove it.

The following packages will be REMOVED:

 nethogs*

0 upgraded, 0 newly installed, 1 to removeand 137 not upgraded.

After this operation, 72.7 kB disk spacewill be freed.

Do you want to continue? [Y/n] Y

(Reading database ... 167632 files anddirectories currently installed.)

Removing nethogs (0.8.1-0.3) ...

Processing triggers for man-db (2.7.5-1)...

root@f49:/usr/sbin# nethogs

-bash: /usr/sbin/nethogs: No such file ordirectory


从左到右依次为:cmdline_namepid uid sent_PBS rev_PBS

 

bool getLocal(const char *device, booltracemode) ----》Adding localaddress: 192.168.0.49

show_trace(lines, nproc) 

       lines[i]->log();

------》

Refreshing:

sshd: root@pts/2/32507/0        623.666 7.88672

unknown TCP/0/0 0       0

 

void process_init() {

 unknowntcp = new Process(0, "", "unknown TCP");

 

3、linux中查看网卡(NIC)的工作模式:全双工/半双工?

root@f56:/home/ws/nethogs-0.8.5/src#ethtool eth0

Settings for eth0:

       Supportedports: [ TP MII ]

       Supportedlink modes:   10baseT/Half 10baseT/Full

                               100baseT/Half100baseT/Full

                               1000baseT/Half1000baseT/Full

       Supportedpause frame use: No

       Supportsauto-negotiation: Yes

       Advertisedlink modes:  10baseT/Half 10baseT/Full

                               100baseT/Half100baseT/Full

                               1000baseT/Full

       Advertisedpause frame use: Symmetric Receive-only

       Advertisedauto-negotiation: Yes

       Linkpartner advertised link modes: 10baseT/Half 10baseT/Full

                                            100baseT/Half100baseT/Full

                                           1000baseT/Full

       Linkpartner advertised pause frame use: No

       Linkpartner advertised auto-negotiation: Yes

       Speed:1000Mb/s

       Duplex: Full

       Port:MII

       PHYAD:0

       Transceiver:internal

       Auto-negotiation:on

       SupportsWake-on: pumbg

       Wake-on:g

       Currentmessage level: 0x00000033 (51)

                            drv probe ifdown ifup

       Linkdetected: yes

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值