Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 symlinked my /host/Users/Kevin folder to /home/Kevin. I also edit the /etc/passwd file to /home/Kevin. I logged out and logged back in, however when I open up a terminal it's a bash prompt like so:


But when I cd or echo $HOME it changes to:


or when I echo $HOME it prints /home/Kevin. How can I make it open up in this format by default?

share|improve this question

migrated from stackoverflow.com Apr 26 '12 at 18:19

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

IIRC this is a limitation of bash, zsh is more clever when the home directory is a symlink. Consider switching to zsh. – Gilles Apr 26 '12 at 23:05
up vote 2 down vote accepted

You could put:

cd $HOME

in your .bash_profile, maybe, or your .bashrc (the latter executes for every shell, the former only for your login shell). The problem, of course, is that anything that walks the filesystem to find your current directory location is going to find /host/Users/Kevin folder to /home/Kevin instead of /home/Kevin.

Instead of symlinking, you could:

mkdir /home/Kevin
mount -o bind /host/Users/Kevin /home/Kevin

This will make /home/Kevin a "real" filesystem path (as opposed to one you get to by way of a symlink). You can add this mount to your /etc/fstab if you like.

share|improve this answer
Don't put it in .bashrc, it would be disruptive when you start a shell in another directory. – Gilles Apr 26 '12 at 23:04
Maybe. I mentioned that as a possibility because sometimes things are configured (e.g., under X or in OS X terminal) such that putting it into .profile or equivalent won't do the right thing, and I'm too lazy to test it out... – larsks Apr 26 '12 at 23:25

Do I understand you correct that you always want it printed like:


that's simple: edit the file .bashrc in your home-directory. usually you'll find a line like this (or maybe more then one):

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

replace the \w with $PWD and save.

share|improve this answer
I want it always printed out like: kevin@ubuntu:~$ – user979663 Apr 26 '12 at 17:26
- sorry, wasn't really clear from your question which format you really want. in this case, larsks answer is better. – mata Apr 26 '12 at 17:35

Your Answer


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