Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

对小白来说,真是难搞

其实,Ubuntu新版本中,默认是没有tree等命令,所以得自己下载安装一下

Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

这两种几乎都是同种情况的,都是该命令无法找到,即命令不存在,所以得安装一下该命令。

解决方法:在终端中输入sudo apt install tree命令(如果是ifconfig问题,则输入:sudo apt install net-tools),如图

Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

可能你的英文的,那也没关系,那是你没转为中文的,然后再次输入tree(或者ifconfig)试一下有没有效果

如果输入了sudo apt install tree,结果又出现了E:Unable to locate package tree等错误,如图

Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

这个也不要怂,磕它。首先就要检查网络,看看是否能正常上网,可以打开浏览器试试,

若是能正常上网,那有可能就是下载源的设置有问题了。

打开设置,打开软件下载服务那个,如图:

Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

接着,如图;

Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

然后出现界面,如图:

Linux中Ubuntu系统在终端输入tree,结果出现 Command 'tree' not found,……的错误或者输入ifconfig -a,结果出现Command 'ifconfig' not found,……等错误

点击“选择最佳服务器”,然后出现一个检查界面,需要耐心等待一下,完成之后,系统会帮你选择一个最佳的下载源服务器(即一个下载网址)。然后你点击选择服务器确认。

然后会出现一个确认更改下载网址的界面,点击同意,或是reload。然后耐心等待一下。

结束了,就可以在终端再试sudo apt install tree命令了。

想要修改为中文时出现Failed to download repository information错误,如果不是网络问题,大概率都是下载网址的问题,

解决方式类似。