今天我把WSL里的环境变量文件弄坏了_出位控的博客-程序员宅基地

技术标签: WSL  软件测试笔记  ubuntu  #入门环境搭建笔记  

今天我把WSL里的环境变量文件弄坏了,怎么办

真是捉急,打什么命令都没有

[email protected]のsp7:~$ ls
Command 'ls' is available in the following places
 * /bin/ls
 * /usr/bin/ls
The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
ls: command not found
[email protected]のsp7:~$ vim .bashrc
Command 'vim' is available in the following places
 * /bin/vim
 * /usr/bin/vim
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
vim: command not found

在网上找到这篇文章解决了。
输入命令:

export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin

这样可以保证命令行命令暂时可以使用。命令执行完之后先不要关闭终端,然后修改环境变量文件。
当前用户的环境变量 vim ~/.bashrc
设置全局变量文件在 vim /etc/profile
系统:win10 + WSL+ Ubuntu20.04

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

智能推荐

随便推点