Setting Your Prompt for Bash

Linux HowTO about editing your command prompt in Bash.

Now I am running Fedora 10, on the first HDD and Ubuntu 9.04 on the second HDD so my default BASH prompt has the following parameters:

“Username, Hostname, and the name of the PWD or present working directory” surrounded in brackets.
ex.: [tech-slave@slave ~]$

FYI Note ” ~ ” is shown to represent your home directory (i.e. ~ = /home/yourusername)

so.. $ cd /bin
[tech-slave@slave bin]$

There are some temporary options that will alter how your prompt appears.

Three examples t (time) d (date) w (displays full path of the PWD)

So to execute the tempory change you would type: $ export PS1=”[t d w]$ “

Giving you [20:43:33 Sat Jun 06 /bin]$

Now to permanently alter these setting for the prompt then make the changes in your ~/.bashrc file for them to last after you close your current shell. Now in other files you might change a setting but with this one you can just add the line at the end of the file and save the change.

arizona.rune@gmail.com

Leave Your Response