Linux查看本机IP有两种方法,一种方法是使用废弃的ifconfig,第二种方法是使用内置的ip。 在Ubuntu 18.04中, net-tools 工具包没有被默认安装,这就意味着不能使用 ifconfig 。但是可以安装 net-tools 。 sudo apt-get install net-tools 然后执行 ifconfig 由于 net-tools 不再维护,强烈建议以 ip 命令代替 ifconfig。 ip a 这条命令将会列出所有网络接口的相关信息。