Unix Commands are not working

1

New to Unix, I recently tried to add a $PATH variable in Unix in order to debug my android sdk. I looked up online the directions and tried to follow them as thoroughly as possible. What ended up happening is that my basic commands no longer work (e.g. ls, man, cd etc...) I get a message stating "-bash: ls: command not found". I am not sure what I might have done. Maybe I might have wrote over the original file.

완벽한 씨

Posted 2011-11-20T04:09:32.060

Reputation: 111

Answers

3

You probably overwrote your PATH variable instead of appending to it. My PATH variable on my computer right now (Ubuntu 11.10) looks like this:

rvoliva@bobby-ubuntu:~$ echo $PATH /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

I'm guessing yours doesn't have any of those bin folders in it at the moment. When you use export to modify your PATH, make sure you append to it:

export PATH=/new/path/location/dir:$PATH

robertvoliva

Posted 2011-11-20T04:09:32.060

Reputation:

Yes. I believe that is what I did. When I echo $PATH it shows a path pointing to my Android SDK folder, which obviously isn't the correct directory. How can I return my PATH variable to the default? I would like to have Unix working normally again. – None – 2011-11-20T05:19:02.403

What distro are you using? – None – 2011-11-20T05:22:52.667

If you modified your startup scripts ($HOME/.bashrc, $HOME/.bash_profile, $HOME/.profile), then back out whatever changes you made. Then launch a new terminal window. – Keith Thompson – 2011-11-20T05:24:40.157

1

You defined PATH such that it doesn't include basic directories like /bin or /usr/bin. Use absolute paths to an editor (i.e., /usr/bin/vi and add those back in. You probably want to be doing something like

export PATH=/my/android/thingy:$PATH

If you leave off the :$PATH at the end, you're ignoring the system default, which prevents you from finding all the usual utilities.

Ernest Friedman-Hill

Posted 2011-11-20T04:09:32.060

Reputation: 855

Thanks a lot I managed to use your help to solve this issue. – None – 2011-11-20T05:34:44.360