Ubuntu 17.04: Shorten bash prompt string

This article will describe shortening bash prompt string.

1 Change \w to \W in ${HOME}/.bashrc

Ubuntu and Debian have long prompt string by default which includes full path of current directory.

username@hostname:/var/lib/git$

Change full path of current directory to current directory with changing \w to \W in ${HOME}/.bashrc.

$ sed -i -e 's/\\w/\\W/g' ~/.bashrc
$ . ~/.bashrc

Now bash prompt string is shortened.

username@hostname:git$

After this change, bash prompt string is shortened by default.