Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't execute any basic command in linux console [closed]

Tags:

linux

bash

I know how the problem was created, but really have no idea how to restore the server command execution.

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).

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.

like image 886
Joe Almore Avatar asked Dec 05 '22 17:12

Joe Almore


1 Answers

Do an export of the binary paths:

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
like image 117
Julien May Avatar answered Dec 08 '22 01:12

Julien May