无法在Linux控制台中执行任何基本命令 [英] Can't execute any basic command in linux console
问题描述
我知道问题的产生原因,但实际上不知道如何恢复服务器命令执行.
I know how the problem was created, but really have no idea how to restore the server command execution.
问题是,我在Ubuntu服务器中配置了Glassfish的环境变量,然后从根目录修改了 .bashrc
文件,并添加了 export
子句( GLASSFISH_HOME
变量)和 PATH
子句(指向 $ GLASSFISH_HOME/bin
).
The thing is, I was configuring the environment variables of Glassfish in my Ubuntu server, and I modified the .bashrc
file from root and added an export
clause (with GLASSFISH_HOME
variable) and a PATH
clause (pointing to the $GLASSFISH_HOME/bin
).
立即关闭控制台并再次将其打开,以使更改生效,然后(BAM!)一旦启动新的控制台会话,则所有基本命令( dir
,查找
, nano
, ifconfig
,任何东西)现在都可以工作,我只能使用 cd
在目录中移动,我正在尝试再次编辑 .bashrc
文件以撤消更改,但也无法对其进行编辑,所有编辑器均无法打开!在命令行中,我只会得到 -bash:dir:找不到命令
.
Right after I close the console and open it again so the changes take effect, and (BAM!) once I start the new console session then none of the basic commands (dir
, find
, nano
, ifconfig
, anything) work now, I can only use cd
to move in directories, I am trying to edit again the .bashrc
file to undo the changes but can't edit it either, none of the editors open! In the command line I only get -bash: dir: command not found
.
请为您提供解决方案;我知道这看似微不足道,但是我有点盲目,无法看到或找到命令/应用程序所在的文件和文件夹.
Please, if you have any solution for this; I know it seems trivial, but I'm kind of blind without being able to see or find the files and folders where commands/applications are located.
推荐答案
导出二进制路径:
export PATH=$PATH:/bin:/usr/bin
此后,您就可以再次进行操作并撤消更改.
right after that you're able again to operate and to reverse your changes.
否则,只要给出您的编辑器二进制文件的完整路径,就可以用您喜欢的编辑器进行
Otherwise just do an edit with your favorite editor while given the full path to your editors binary:
/usr/bin/emacs -nw /root/.bashrc
这篇关于无法在Linux控制台中执行任何基本命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!