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.


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.


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