Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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'm a newcomer to Ubuntu (and linux in general) and since I have a machine spare, I have Ubuntu Server (terminal only) installed on one of my machines. I've recently started playing around with my dotfiles, however it seems I've messed something up as changing directory to '~' no longer presents me with the expected user's home directory!

The .bashrc file that's in my dotfiles directory then points to a ".env" file at ~/bin/dotfiles/.env which contains the following:

export EDITOR="nano"
export PATH=$PATH:~/bin
export home="/home/joe/"
export dotfiles="/home/joe/bin/dotfiles"

Does anyone have any ideas to restore the tilde to my user's home location?

share|improve this question
With what user your are trying to cd ~? – topless Apr 22 '11 at 9:21
The only user on the machine ("joe") - it worked absolutely fine until I messed around wit the .bashrc file. – joesavage Apr 22 '11 at 9:25
If you put it back under joe's home does it works? I have the suspicion that configuration files for your profile and applications had to be under your home. – topless Apr 22 '11 at 9:31
Put what back? I replaced the files - I can't put it back :P (I have a feeling that it was stored in that file though) – joesavage Apr 22 '11 at 9:32
You said you changed it to . ~/bin/dotfiles/.bashrc you can mv /home/joe/bin/dotfiles/.bashrc /home/joe/.bashrc – topless Apr 22 '11 at 9:33
up vote 8 down vote accepted

~ takes you to whatever the variable $HOME points to.

Therefore, run

echo $HOME

to see the value of $HOME. Then find where $HOME is set to that inappropriate directory and fix it.

share|improve this answer
Thanks - worked a treat :D – joesavage Apr 22 '11 at 10:47

Your Answer


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.