/**PageBeginHtml Block Begin **/ /***自定义返回顶部小火箭***/ /*生成博客目录的JS 开始*/ /*生成博客目录的JS 结束*/

【Ubuntu 无法使用ifconfig解决办法】

【Ubuntu 无法使用ifconfig解决办法】

 
Ubuntu 无法使用ifconfig解决办法
在使用ubuntu时需要使用ifconfig命令提示

Command 'ifconfig' not found, did you mean:

  command 'iconfig' from deb ipmiutil (3.1.5-1)
   command 'pifconfig' from deb python3-ethtool (0.14-3build1)
   command 'fconfig' from deb redboot-tools (0.7build3)
Try: sudo apt install <deb name>

在网上找了很多方法说尝试

sudo apt-get update
apt-get install net-tools

和更换镜像源还是不行。
最后发现在 Ubuntu 20.04 中,ifconfig 命令已被弃用并替换为 ip 命令。
可以使用以下命令来查看网络接口和 IP 地址:

ip addr show

该命令将显示当前系统上所有网络接口的详细信息,包括每个接口的 IP 地址、MAC 地址和其他网络配置。如果只想查看特定接口的信息,可以在命令后面加上接口名,如下所示:

ip addr show eth0

其中 eth0 是要查看信息的接口名称。

最近通过更换清华镜像源后成功安装了ifconfig;
具体步骤如下

[安装ifconfig解决方法]:
1、在 /etc/apt/sources.list 末尾增加如下源
sudo gedit /etc/apt/sources.list 【修改sources.list文件需要使用sudo赋予权限】
将如下copy,粘贴至sources.list

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse

注意: 这里的“focal”是ubuntu20.04的版本代号。
     ubuntu18.04的版本代号是“bionic”
      可以在终端通过 lsb_release -a 进行查看 即Codename所对应的值
      2、然后更新

sudo apt-get update

最后安装

sudo apt install net-tools
————————————————

                            版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                        
原文链接:https://blog.csdn.net/qq_40945712/article/details/129550385

posted @ 2025-01-12 22:10  一品堂.技术学习笔记  阅读(232)  评论(0)    收藏  举报