我在学习 Linux 时曾尝试在 Ubuntu 上使用 finger 命令。几个小时后,Ubuntu 无法正常启动。
当我启动 Ubuntu 时,我得到如下几行信息:
Command 'uname' is available in the following places
* /bin/uname
* /usr/bin/uname
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
uname: command not found
Command 'lesspipe' is available in the following places
* /bin/lesspipe
* /usr/bin/lesspipe
The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
lesspipe: command not found
Command 'dircolors' is available in the following places
* /bin/dircolors
* /usr/bin/dircolors
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
这种情况一直持续到最后:
Command 'tr' is available in the following places
* /bin/tr
* /usr/bin/tr
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
tr: command not found
-bash: export: `=/home/mpl/miniconda3/bin/x86_64-conda-linux-gnu-strings': not a valid identifier
Command 'uname' is available in the following places
* /bin/uname
* /usr/bin/uname
The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
uname: command not found
$ echo $PATH
印刷:
/home/mpl/bin:/home/mpl/bin:PATH
$ export PATH=$PATH:/usr/bin
$ sudo nano /etc/environment
印刷:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
答案1
这将解决你的问题:
cp ~/.bashrc ~/.bashrc.bak
cp /etc/skel/.bashrc ~/
source ~/.bashrc
请注意,这将覆盖您的~/.bashrc
,并且必须从备份文件中插入任何自定义内容~/.bashrc.bak
。
答案2
您似乎已经摆弄过了,可能是对~/.profile
系统路径进一步调整的文件进行了调整。
可能以下操作已经解决了该问题:~/.profile
在文本编辑器中打开并更正
/home/mpl/bin:/home/mpl/bin:PATH
读书
/home/mpl/bin:$PATH
请注意,我们将PATH
其改为$PATH
,这要求将该字符串替换为PATH
此时变量的内容。
还要注意,我们删除了第二次出现的/home/mpl/bin:
。这会重复相同的路径,唯一的影响是这会降低系统速度,因为会在同一路径上搜索两次可执行文件。
如果您严重弄乱了您的个人 bash 文件,即.profile
和.bashrc
,您可以考虑用默认文件替换它们,可以在中找到/etc/skel
。