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?

link|improve this question

80% accept rate
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
feedback

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)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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