Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

root@vivek-HP-Pavilion-dv6-Notebook-PC:/var/www/abc/def/

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
add comment

1 Answer

up vote 3 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
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.