OpenSUSE 13: Shorten bash prompt string

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

Android | Linux | SDL - Narrow Escape