This article will describe shortening bash prompt string. There are two ways, first is changing etc/bash.bashrc, second is redefinition PS1 in ${HOME}.bashrc.
Table of Contents
1 Change \w to \W in /etc/bash.bashrc
PS1 is defined in /etc/bash.bashrc. Change \w, which will output full path, to \W, which will output current directory.
> sudo sed -i -e 's/\\w/\\W/g' /etc/bash.bashrc
2 Redefine PS1 in ${HOME}/.bashrc
Redefine PS1 in ${HOME}/.bashrc which is load after /etc/bash.bashrc. \u is username, \h is hostname and \W is current directory.
> echo 'export PS1="\u@\h:\W> "' >> ~/.bashrc