Print this page

BASH Prompt Show only PWD

 

In ubuntu and I think Trustix, the prompt gets ridiculously long when you've
cd'd to a deep directory. This is because the bash (bourne again shell) prompt is defined in the
bash.bashrc or bashrc file using the \w switch. To fix this to make it behave
like Redhat, change the \w to \W.

This can be set system wide in the bashrc or bash.bashrc files, but it may
also have to be set in your homedir's copy of bash rc file.