centos7 最小化安裝之後,默認是沒有 ifconfig,netstat命令的;
我們可以直接使用 yum -y install net-tools 即可
- 先來看下 net-tools的信息
[admin@localhost ~]$ yum info net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirrors.aliyun.com
* updates: mirror.bit.edu.cn
Available Packages
Name : net-tools
Arch : x86_64
Version : 2.0
Release : 0.25.20131004git.el7
Size : 306 k
Repo : base/7/x86_64
Summary : Basic networking tools
URL : http://sourceforge.net/projects/net-tools/
License : GPLv2+
Description : The net-tools package contains basic networking tools,
: including ifconfig, netstat, route, and others.
: Most of them are obsolete. For replacement check iproute package.
從描述中可以看到net-tools包中包含基本的網絡工具,包括ifconfig,netstat,route等
- 安裝net-tools ,需要管理員權限
[admin@localhost ~]$ sudo yum -y install net-tools
[sudo] password for admin:
- 驗證命令
[admin@localhost ~]$ netstat -an | grep 8080
tcp6 0 0 :::8080 :::* LISTEN
完美!