Debian 9: 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.

hiroom2@debian-9:/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.

hiroom2@debian-9:git$

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