Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to install Android developer tools on Eclipse, and I followed the information in this video.

Like the video said, I added the following two lines of code to the .bashrc file:

export PATH=$(PATH):-/android-sdk/tools/
export PATH=$(PATH):-/android-sdk/platform-tools/

It seems, however, that this did not help me to install the Android files on Eclipse, as I am still having problems with that. What's more, it seems that I can't make any command in the terminal without getting a major error now! Every time I try to make a command in the terminal I get the following message:

The command could not be located because '/usr/bin' is not included in the PATH environment variable.

Is there away to restore .bashrc to its default?

share|improve this question
2  
possible duplicate of How to restore .bashrc – Eliah Kagan Sep 18 '14 at 0:07
up vote 21 down vote accepted

Type the following in your terminal,

/bin/cp /etc/skel/.bashrc ~/

It will replace your corrupt ~/.bashrc with a fresh one. After that you need to source the ~/.bashrc so that the change take place immediately, write in terminal,

source ~/.bashrc

or if that does not work you can close the terminal and open it again.

share|improve this answer
    
Thank you for the response! For some reason I am still getting the error message – sarahrahrah Jan 12 '14 at 20:04
    
what is the exact error message? – souravc Jan 13 '14 at 2:08
    
Command 'cp' is available in '/bin/cp' The command could not be located because '/bin' is not included in the PATH environment variable. cp: command not found – sarahrahrah Jan 13 '14 at 13:23
    
what is the output of echo $PATH? – souravc Jan 13 '14 at 13:26
3  
Note, this is essentially an overkill solution and will remove any other modification that you have done to the file. – Braiam May 9 '14 at 0:39

If you can't get a working shell

Via the file browser

  • Open the file browser, go to the home directory, press CtrlH so that hidden files are shown. Edit .bashrc as needed.
  • Open the file browser, go to /etc/skel, press CtrlH so that hidden files are shown. Copy .bashrc to your home folder to restore it to the default.

Via the run menu

  • Press AltF2, type gedit .bashrc, press Enter. Edit as needed.
  • Press AltF2, use the command /bin/cp /etc/skel/.bashrc ~/ as given in souravc's answer to restore it to the default.

Via the terminal

  • Open the terminal, and ignore that you don't have a shell. Go to EditPreferencesProfiles:

    enter image description here

  • Either create a new profile, or edit the current profile, to change the command:

    enter image description here

    Use either /bin/bash --norc or /bin/bash --rcfile=/etc/skel/.bashrc.

  • Start a new tab (with the custom profile, if you created one). Use the working shell as needed.
  • Delete the custom profile, or uncheck the custom command option if you edited the default profile, once you're done.
share|improve this answer

Via the TTY

You can enter the TTY by pressing ctrl+alt+f1 where you have to login with your user-name and your password. ctrl+alt+f7 will bring you back to your GUI later.

Now copy the existing raw .bashrc from /etc/skel to your home directory by

cp /etc/skel/.bashrc ~/

Maybe even bring the rest over if you're not sure if your .profile was changed too.

cp /etc/skel/.profile ~/

Now to get the .bashrc to have immediate effect you might want to source it with:

source ~/.bashrc

If you did replace your .profile as well you need to reboot to make it take effect.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.