1. 序言

如笔者在本机上运行netstat时,提示没有这个命令,向来简单粗暴,直接yum -y install netstat,显然是不能正常安装的。

[root@hadoop-103 ~]# yum -y install netstat
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/2): extras/7/x86_64/primary_db | 153 kB 00:00:00
(2/2): updates/7/x86_64/primary_db | 5.1 MB 00:00:02
No package netstat available.
Error: Nothing to do
[root@hadoop-103 ~]#

这种情况下,怎么办呢?

2. 使用“yum search”命令

此时可以使用“yum search”来查询这个命令在哪个包中:

[root@hadoop-103 ~]$ yum search netstat
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
========================================================= Matched: netstat =========================================================
dstat.noarch : Versatile resource statistics tool
net-snmp.x86_64 : A collection of SNMP protocol tools and libraries
net-tools.x86_64 : Basic networking tools #这里已经给出了netstat命令所在包

接着直接安装这个包即可:yum -y install net-tools

3.使用“yum whatprovides ”查询命令所在的包

还可以使用yum whatprovides

[root@hadoop-103 ~]# yum  whatprovides *netstat
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base/7/x86_64/filelists_db | 7.3 MB 00:00:04
extras/7/x86_64/filelists_db | 207 kB 00:00:00
updates/7/x86_64/filelists_db | 3.0 MB 00:00:01
1:net-snmp-utils-5.7.2-43.el7.x86_64 : Network management utilities using SNMP, from the NET-SNMP project
Repo : base
Matched from:
Filename : /usr/bin/snmpnetstat net-tools-2.0-0.25.20131004git.el7.x86_64 : Basic networking tools
Repo : base
Matched from:
Filename : /bin/netstat zsh-5.0.2-33.el7.x86_64 : Powerful interactive shell
Repo : base
Matched from:
Filename : /usr/share/zsh/5.0.2/functions/_netstat net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repo : @base
Matched from:
Filename : /bin/netstat [root@hadoop-103 ~]#

参考链接:https://blog.csdn.net/xuejinliang/article/details/52777475

最新文章

  1. VB 思维导图总结(三)
  2. php 建立类POST/GET 的HTTP请求
  3. WinForm应用程序退出的方法
  4. Mac OS X 好用的软件包管理工具 Homebrew
  5. spark的action和transformations汇集
  6. 关于javascript removeChild的那些事
  7. JEECG&Dubbo Demo
  8. Java开发规范总结
  9. monitor.sh
  10. 【剑指offer】合并有序链表
  11. MATLAB——BP神经网络
  12. swift学习第一天---常量变量基础数据类型
  13. Ubuntu 开机自启动SSH+远程关机
  14. java Filter过滤器例外URL设置
  15. Nginx配置虚拟主机
  16. 指定文件兼容性模式 < meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" />的意义
  17. 安装apr报错rm: cannot remove `libtoolT': No such file or directory
  18. python的日志模块logging和syslog
  19. PHPExcel导入导出 若在thinkPHP3.2中使用(无论实例还是静态调用(如new classname或classname::function)都必须加反斜杠,因3.2就命名空间,如/classname
  20. spark 性能调优(一) 性能调优的本质、spark资源使用原理、调优要点分析

热门文章

  1. webview访问URL
  2. Typora + PicGo + Gitee 实现图片自动上传到图床
  3. Spring Security系列之极速入门与实践教程
  4. bootstrap-treeview 研究一下
  5. Fortify Audit Workbench Cookie Security: Cookie not Sent Over SSL
  6. mongoose子文档生成不了_id,查询困难的解决办法
  7. 部分浏览器 set-cookie 不成功踩坑记录
  8. Python创建一个爬虫项目===从零开始哟!想说的下次 要不要出一期关于pycharm与Python之间的合作
  9. x86架构:从实模式进入保护模式
  10. Python自动化运维 技术与最佳实践PDF高清完整版免费下载|百度云盘|Python基础教程免费电子书