Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

migrated from stackoverflow.com Nov 21 '11 at 3:34

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
    
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. –  Randolphg Nov 20 '11 at 5:19
    
What distro are you using? –  robertvoliva Nov 20 '11 at 5:22
    
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 Nov 20 '11 at 5:24
    
Thanks a lot guys. I managed to fix the problem! :^) –  Randolphg Nov 20 '11 at 5:34
add comment

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.

share|improve this answer
    
Thanks a lot I managed to use your help to solve this issue. –  Randolphg Nov 20 '11 at 5:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.