在咱们新装置的Ubuntu 20.04操作系统中,咱们想要查看ip地址,发现应用ifconfig命令,提醒找不到这个命令。在上面文章汇总,会介绍如何装置这个工具。
当在运行ifconfig命令是,提醒上面的谬误,就代表没有装置它:
bob@ubuntu-20-04:~$ ifconfig
Command 'ifconfig' not found, but can be installed with:
sudo apt install net-tools
或者提醒上面的信息:
-bash: ifconfig: command not found
在Ubuntu 20.04中,不倡议应用ifconfig命令。这就是为什么会收到无关短少的ifconfig命令的谬误的起因。若想要查看ip地址。能够应用ip addr命令,它简直能够执行与ifconfig命令雷同的工作,如上面的代码所示:
bob@ubuntu-20-04:~$ ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:40:d4:6f brd ff:ff:ff:ff:ff:ffinet 192.168.43.174/24 brd 192.168.43.255 scope global dynamic noprefixroute ens33 valid_lft 1337sec preferred_lft 1337secinet6 fe80::7559:c488:6787:289d/64 scope link noprefixroute valid_lft forever preferred_lft forever
如何解决Ubuntu提醒没有找到ifconfig命令如何解决Ubuntu提醒没有找到ifconfig命令
从下面代码输入中能够看到,该命令仍将显示所有网络接口的IP地址和其余统计信息。
如果习惯应用旧的ifconfig命令,则须要装置net-tools软件包。net-tools是一个工具包,其中蕴含形成Linux网络根底的一系列程序。这些包含:
ifconfig
netstat
dig
hostname
route
arp
iptunnel
解决ifconfig命令找不到的问题
要解决以上谬误,就须要装置net-tools工具包:
bob@ubuntu-20-04:~$ sudo apt install net-tools
如何解决Ubuntu提醒没有找到ifconfig命令如何解决Ubuntu提醒没有找到ifconfig命令
装置胜利实现后,再次尝试运行ifconfig命令,能够看到相熟的脸孔了。
总结
ifconfig曾经逐步被ip addr取代了,因为当初大部分发行版本,比方Centos\RHEL、Fedora、Ubuntu等零碎都勾销了net-tools工具包了。