I added the following line to the end of my ~/.bashrc (This is on a Linode box) and logged out of my ssh session.

source ~/.profile

Now when I log in, the shell is unresponsive. I never get to the prompt and entering commands does nothing.

If I Ctrl-c then it closes the ssh connection. Ctrl-z does nothing either. I can't get access to the ~/.profile to try and see what the issue is.

How can I get the prompt back?


To get your shell back, just use this procedure.

Hope you remember the contents of .bashrc what were earlier there. It should be something like this:

# .bashrc

# Source global definitions
    if [ -f /etc/bashrc ]; then
        . /etc/bashrc

Put them into a file with the same name, .bashrc, on the machine from where you can access your Linode machine.

Now use this command:

 # scp .bashrc server:.

This will replace your modified .bashrc with this default one and you should be able to get your shell back.

Please let me know in case you face any issues with this.

  • Yeah I was thinking of going this route but just wanted to check that there wasn't an obviously better way. Luckily there weren't many modifications and I found a default bashrc. – duckyfuzz Mar 26 '13 at 4:38
  • Great. Glad to help. – GeekRide Mar 26 '13 at 6:54
  • using similar mechanism, you could first scp FROM the machine to another one, and thus have its real content, take out the offendign line, and scp it back on the machine. – Olivier Dulac Mar 26 '13 at 13:39

People already have asked you how to fix this. But why this has happened to you?

In Debian/Ubuntu, there's this piece of code in ~/.profile:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"

So, by default, ~/.profile is including ~/.bashrc. If you tell ~/.bashrc to include ~/.profile, you are creating an infinite loop.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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