You want to modify the PS1 enfironment variable. Do this at a prompt:
You'll see something like:
[\u@\h \w]\$
Again, yours may be different. All those backslash-character combinations represent something significant to the shell, and they get replaced when the prompt is actually printed. You can read about what's available with the man page for bash (
man bash) The man page is rather long, and you only need to see one particular section. So start a search by hitting a forward slash ( / ), type "PROMPTING" (should be all upper case), hit Enter/Return, and then press 'n' until you see the man page highlight the heading of the PROMPTING section. You'll see a list of all the codes you can use and what they expand to. If you use something that is not one of those codes, it's probably taken literally and printed verbatim in the prompt(like the open and close square braces in the example above).
To change your prompt, change the value it is assigned in one of two files.
Edit ~/.bash_profile to make the change only for one particular user.
Edit /etc/profile to make the change global for every user (each user can override this setting if they make a change in their personal ~/.bash_profile)
If you don't see any lines where PS1 is modified in the file you opened, then add these lines:
Code:
PS1='your custom string here'
export PS1
Otherwise, just substitute your customized value for whatever was there to begin with.
Save the file, and the next time you log in, your prompt should be what you set it to.
You can test it before adding to the file by executing:
Code:
export PS1='your custom string here'