Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Whenever I go inside a directory in Linux, it shows the file path at prompt like:


How can I change it to show short names instead?

share|improve this question
Assuming you use bash, what's the value of your PS1 variable? What would you like your prompt to be instead? – glenn jackman Aug 8 '11 at 17:05
[\e]0;\u@\h: \w\a]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ – Vivek Goel Aug 8 '11 at 17:21
You can safely keep the old one and just change the \w to \W too. – slhck Aug 8 '11 at 17:25
up vote 4 down vote accepted

Add the following to ~/.bashrc or ~/.bash_profile or ~/.profile (whatever you have or want – what is the difference?):

PS1="\u@\h:\W $ "

This will produce:

werner@charon:Documents $ cd /etc/paths.d/
werner@charon:paths.d $ 

More infos: How to: Change / Setup bash custom prompt (PS1)

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.