1

In the terminal prompt, how do I get to see the full path of the home directory?

That is, from

root@pcname:~ # 

to

root@pcname:/home/username #

closed as unclear what you're asking by αғsнιη, chaos, user117103, David Foerster, Braiam Mar 1 '15 at 16:09

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • FYI, the Ubuntu version does not make any difference. – Andrea Corbellini Feb 25 '15 at 12:52
  • O...IC. For some reason I wanted to know, though. Didn't fully realize the "~" was used as an abbreviation (The title of this question was different...the new title could also help others, though). Thanks. – aksub Feb 27 '15 at 2:02
  • My actual question implied that there was a difference between the files shown under each...but if it is indeed an abbreviation I won't make any more trouble...(just making sure)... – aksub Feb 27 '15 at 2:18
  • Are you using bash? zsh? – Braiam Mar 1 '15 at 16:09
  • @KasiyA,@chaos,@guntbert,@DavidFoerster,@Braiam: My original question was edited. Did you put on hold that one, or the edited one? – aksub Mar 2 '15 at 0:49
4

In your prompt (look for PS1 in your .bashrc), use $PWD instead of \w.

For example, your .bashrc would contain:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi

In both cases, change the second \w to $PWD:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]$PWD\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:$PWD\$ '
fi

According to man bash, \w is the abbreviated path:

\w     the current working directory, with $HOME abbreviated with a tilde (uses the value of the PROMPT_DIRTRI`M variable)

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