The PS1 in this example displays following three information in the prompt:
- \u – Username
- \h – Hostname
- \W – Base name of the current working directory
-bash-3.2$ export PS1="\u@\h \W> " ramesh@dev-db ~> cd /etc/mail ramesh@dev-db mail>
In this example, the Linux prompt changed from the boring “-bash-3.2$” to a meaningful “ramesh@dev-db mail>”, in which it represents the following:
- ramesh is the users who is currently logged into the Linux system.
- dev-db is the host name of the Linux machine.
- mail is the current working directory. i.e (/etc/mail)