一、安装nethogs

centos6版本安装:

1、安装依赖包

[root@hlsms-fensheng- ~]# yum install ncurses*
已加载插件:fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
base | 3.7 kB :
dell-system-update_dependent | 2.3 kB :
dell-system-update_independent | 2.3 kB :
extras | 3.4 kB :
mysql-connectors-community | 2.5 kB :
mysql-tools-community | 2.5 kB :
mysql57-community | 2.5 kB :
updates | 3.4 kB :
包 ncurses-devel-5.7-4.20090207.el6.x86_64 已安装并且是最新版本
包 ncurses-5.7-4.20090207.el6.x86_64 已安装并且是最新版本
包 ncurses-libs-5.7-4.20090207.el6.x86_64 已安装并且是最新版本
包 ncurses-base-5.7-4.20090207.el6.x86_64 已安装并且是最新版本
解决依赖关系
--> 执行事务检查
---> Package ncurses-static.x86_64 :5.7-4.20090207.el6 will be 安装
---> Package ncurses-term.x86_64 :5.7-4.20090207.el6 will be 安装
--> 完成依赖关系计算 依赖关系解决 ====================================================================================================================================================
软件包 架构 版本 仓库 大小
====================================================================================================================================================
正在安装:
ncurses-static x86_64 5.7-4.20090207.el6 base k
ncurses-term x86_64 5.7-4.20090207.el6 base k 事务概要
====================================================================================================================================================
Install Package(s) 总下载量:1.1 M
Installed size: 5.1 M
确定吗?[y/N]:y
下载软件包:
(/): ncurses-static-5.7-4.20090207.el6.x86_64.rpm | kB :
(/): ncurses-term-5.7-4.20090207.el6.x86_64.rpm | kB :
----------------------------------------------------------------------------------------------------------------------------------------------------
总计 kB/s | 1.1 MB :
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : ncurses-term-5.7-4.20090207.el6.x86_64 /
正在安装 : ncurses-static-5.7-4.20090207.el6.x86_64 /
Verifying : ncurses-static-5.7-4.20090207.el6.x86_64 /
Verifying : ncurses-term-5.7-4.20090207.el6.x86_64 / 已安装:
ncurses-static.x86_64 :5.7-4.20090207.el6 ncurses-term.x86_64 :5.7-4.20090207.el6 完毕!
[root@hlsms-fensheng- ~]# yum install libpcap*
已加载插件:fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
包 :libpcap-devel-1.4.-.20130826git2dbcaa1.el6.x86_64 已安装并且是最新版本
包 :libpcap-1.4.-.20130826git2dbcaa1.el6.x86_64 已安装并且是最新版本
无须任何处理

2、下载源码包

[root@hlsms-fensheng- ~]# cd /usr/local/src/
[root@hlsms-fensheng- src]# wget https://github.com/raboof/nethogs/archive/v0.8.1.tar.gz
---- ::-- https://github.com/raboof/nethogs/archive/v0.8.1.tar.gz
正在解析主机 github.com... 52.74.223.119
正在连接 github.com|52.74.223.119|:... 已连接。
已发出 HTTP 请求,正在等待回应... Found
位置:https://codeload.github.com/raboof/nethogs/tar.gz/v0.8.1 [跟随至新的 URL]
---- ::-- https://codeload.github.com/raboof/nethogs/tar.gz/v0.8.1
正在解析主机 codeload.github.com... 13.250.162.133
正在连接 codeload.github.com|13.250.162.133|:... 已连接。
已发出 HTTP 请求,正在等待回应... OK
长度:未指定 [application/x-gzip]
正在保存至: “v0.8.1.tar.gz” [ <=> ] , --.-K/s in .1s -- :: ( KB/s) - “v0.8.1.tar.gz” 已保存 []

3、编译

[root@hlsms-fensheng- src]# tar -zxvf v0.8.1.tar.gz
nethogs-0.8./
nethogs-0.8./.cproject
nethogs-0.8./.cvsignore
nethogs-0.8./.gitignore
nethogs-0.8./.project
nethogs-0.8./.travis.yml
nethogs-0.8./COPYING
nethogs-0.8./Changelog
nethogs-0.8./DESIGN
nethogs-0.8./INSTALL
nethogs-0.8./Makefile
nethogs-0.8./README.decpcap.txt
nethogs-0.8./README.md
nethogs-0.8./connection.cpp
nethogs-0.8./connection.h
nethogs-0.8./conninode.cpp
nethogs-0.8./conninode.h
nethogs-0.8./cui.cpp
nethogs-0.8./cui.h
nethogs-0.8./decpcap.c
nethogs-0.8./decpcap.h
nethogs-0.8./decpcap_test.cpp
nethogs-0.8./devices.cpp
nethogs-0.8./devices.h
nethogs-0.8./inode2prog.cpp
nethogs-0.8./inode2prog.h
nethogs-0.8./main.cpp
nethogs-0.8./nethogs.
nethogs-0.8./nethogs.cpp
nethogs-0.8./nethogs.h
nethogs-0.8./packet.cpp
nethogs-0.8./packet.h
nethogs-0.8./process.cpp
nethogs-0.8./process.h
nethogs-0.8./refresh.cpp
nethogs-0.8./refresh.h
[root@hlsms-fensheng- src]# cd nethogs-0.8./
[root@hlsms-fensheng- nethogs-0.8.]# make && make install
g++ -Wall -Wextra -c packet.cpp
g++ -Wall -Wextra -c connection.cpp
g++ -Wall -Wextra -c process.cpp
g++ -Wall -Wextra -c refresh.cpp
cc -Wall -Wextra -c decpcap.c
g++ -Wall -Wextra -c cui.cpp -DVERSION=\"0\" -DSUBVERSION=\"8\" -DMINORVERSION=\"1\"
g++ -Wall -Wextra -c inode2prog.cpp
g++ -Wall -Wextra -c conninode.cpp
g++ -Wall -Wextra -c -o devices.o devices.cpp
g++ -Wall -Wextra main.cpp packet.o connection.o process.o refresh.o decpcap.o cui.o inode2prog.o conninode.o devices.o -o nethogs -lpcap -lm -lncurses -DVERSION=\"0\" -DSUBVERSION=\"8\" -DMINORVERSION=\"1\"
g++ -Wall -Wextra decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm
install -d -m /usr/local/sbin
install -m nethogs /usr/local/sbin
install -d -m /usr/local/share/man/man8/
install -m nethogs. /usr/local/share/man/man8/
[root@hlsms-fensheng- nethogs-0.8.]#

4、运行

[root@hlsms-fensheng- nethogs-0.8.]# nethogs em1
Waiting for first packet to arrive (see sourceforge.net bug )
NetHogs version 0.8. PID USER PROGRAM DEV SENT RECEIVED
mysql /usr/sbin/mysqld em1 11.513 0.756 KB/sec
? root 172.28.5.152:-172.28.5.151: 0.000 0.012 KB/sec
? root 172.28.5.152:-172.28.5.148: 0.000 0.000 KB/sec
? root 172.28.5.152:-172.28.5.148: 0.000 0.000 KB/sec
? root 172.28.5.152:-172.28.5.148: 0.000 0.000 KB/se

可以看到哪个进程占用带宽

centos7版本安装:

[root@bogon ~]# yum install nethogs
已加载插件:fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB ::
epel | 5.3 kB ::
extras | 3.4 kB ::
updates | 3.4 kB ::
(/): epel/x86_64/updateinfo | 1.0 MB ::
(/): epel/x86_64/primary_db | 6.8 MB ::
正在解决依赖关系
--> 正在检查事务
---> 软件包 nethogs.x86_64.0.0.8.5-.el7 将被 安装
--> 解决依赖关系完成 依赖关系解决 =============================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================
正在安装:
nethogs x86_64 0.8.-.el7 epel k 事务概要
=============================================================================================================================================
安装 软件包 总下载量: k
安装大小: k
Is this ok [y/d/N]: y
Downloading packages:
nethogs-0.8.-.el7.x86_64.rpm | kB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : nethogs-0.8.-.el7.x86_64 /
验证中 : nethogs-0.8.-.el7.x86_64 / 已安装:
nethogs.x86_64 :0.8.-.el7 完毕!

最新文章

  1. DBSCAN密度聚类算法
  2. DDD开发框架ABP之本地化资源的数据库存储扩展
  3. OS X运行AFNI的AlphaSim提示libgomp.1.dylib找不到的解决办法
  4. 自动布局之autoresizingMask使用详解(Storyboard&amp;Code)
  5. matlab 之字体调整
  6. 字符串模拟赛T3
  7. JS如何获取iframe内html的body值
  8. Android Framework------之Input子系统
  9. 【我们都爱Paul Hegarty】斯坦福IOS8公开课个人笔记19 为Demo添加手势
  10. 写一个函数,参数为$n,生成一个数组,其元素为1~$n,各元素位置随机排列,不得重复
  11. Hibernate知识点总结
  12. 单服务员排队模拟100天matlab实现
  13. Android 原生listview item伸展收缩效果 (续)
  14. jQuery 对象与Dom 对象互转
  15. Codeforce 854 A. Fraction
  16. springboot AOP全局拦截日志记录
  17. IDEA中添加servlet的jar
  18. JavaScript 中的 FileReader
  19. linux安装Subversion版本控制工具(Subversion + Apache + jsvnadmin)
  20. Effective Java 第三版—— 86. 非常谨慎地实现SERIALIZABLE接口

热门文章

  1. redis(2)事务的订阅与发布
  2. 浅谈微信小程序生命周期
  3. TensorFlow实战第二课(添加神经层)
  4. 【Linux开发】linux设备驱动归纳总结(三):2.字符型设备的操作open、close、read、write
  5. PHP Excel导入
  6. Js 原型,原型链
  7. PHP反序列化进阶寻找和构造
  8. idea自动化部署插件 Alibaba Cloud Toolkit 使用记录
  9. thinkPHP模型before_insert新增前 before_update更新前 before_write写入前 区别
  10. PHP使用CURL抓取页面