Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

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
up vote 13 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 ~/.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\]\$ '
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
unset color_prompt force_color_prompt

Change \w to \W in both lines and open a new terminal (or run source ~/.bashrc).

share|improve this answer

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.