Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to show in the terminal line only the current directory, not the whole path from the home folder?

I have now this: ilya@ubuntu:~/Dropbox/Web/folder/folder/$ and it takes almost all the screen...

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

The part before the $ in a shell is called prompt. It can be configured by changing the variable $PS1. There are is a similar question with good answeres.

The man page (see "Bash" and there "PROMPTING") says:

      \w     the  current working directory, with $HOME
             abbreviated with a tilde (uses the value of the
             PROMPT_DIRTRIM variable)
      \W     the basename of the current working directory,
             with $HOME abbreviated with a tilde

So you have to change \w to \W. Probably the initial value for $PS1 is stored in your .bashrc, that means you have to edit the file /home/YOUR-USER-NAME/.bashrc and you will find lines similar to:

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
unset color_prompt force_color_prompt

Change \w to \W in both lines and open a new terminal.

share|improve this answer
add comment

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.