在我们新安装的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:00 inet 127.0.0.1/8 scope host lo valid_lft forever prefer