本文共 1148 字,大约阅读时间需要 3 分钟。
问题表现为许多命令无法使用,如图
lisa@lisa-VirtualBox:~$ ls
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found
而且无法再次使用nano ~/.bashrc指令来修改出错部分
lisa@lisa-VirtualBox:~$ nano ~/.bashrc
Command 'nano' is available in '/bin/nano'
The command could not be located because '/bin' is not included in the PATH environment variable.
nano: command not found
解决办法:在/usr/bin目录下运行vi 指令来编辑根目录的.bashrc文件
lisa@lisa-VirtualBox:~$ cd /usr/bin
lisa@lisa-VirtualBox:/usr/bin$ vi ~/.bashrc
将错误的PTAH修改为PATH后,退出vi编辑器,使用source ~/.bashrc后,发现ls等指令仍然不能使用
此时需要切换到root用户,再使用source ~/.bashrc
切换到root用户后 使用source ~/.bashrc
lisa@lisa-VirtualBox:/usr/bin$ sudo -i
[sudo] password for lisa:
root@lisa-VirtualBox:~# source ~/.bashrc
再切换到正常用户,基本指令就可以使用了
root@lisa-VirtualBox:~# su lisa
lisa@lisa-VirtualBox:/root$ cd
lisa@lisa-VirtualBox:~$ ls
anaconda3 aspera-connect-3.6.2.117442-linux-64_1.tar.gz Desktop Downloads lisa@v Pictures Templates
Anaconda3-5.2.0-Linux-x86_64.sh aspera-connect-3.6.2.117442-linux-64.sh Documents hisat2-2.1.0-source.zip Music Public Videos
lisa@lisa-VirtualBox:~$
转载地址:http://izrav.baihongyu.com/