The operating system and its version have not yet been provided.
the ~/.bashrc file linked to in a comment is clearly not the default in Ubuntu or any official flavor.
you can compare your ~/.bashrc with the original in /etc/skel/bashrc
If the question does involve a supported version of Ubuntu or its official flavors, Customizing Bash Prompt should apply.
But I don't need to do this:
Comment out the default PS1 that's already there by typing a hash mark ( # ) at the beginning of the line, then define your own PS1 and PS2 just below it.
Just adding what I need at the very end of my ~/.bashrc is sufficient. To get a prompt like what is shown in the image, modify ~/.bashrc using a plain text editor to have this line at the very end:
PS1="\[\033[32m\][\u@\h \w]$ \[\033[0m\]"
Save the file and close all open terminals. Now when a terminal is launched, the new prompt is used.
While the link provided above lists the most common components of PS1, look at this or this or just search the internet for much more.
~/.bashrc
file linked to in a comment is clearly not the default in Ubuntu or any official flavor.~/.bashrc
with the original in/etc/skel/bashrc
If the question does involve a supported version of Ubuntu or its official flavors, Customizing Bash Prompt should apply.
But I don't need to do this:
Just adding what I need at the very end of my
~/.bashrc
is sufficient. To get a prompt like what is shown in the image, modify~/.bashrc
using a plain text editor to have this line at the very end:Save the file and close all open terminals. Now when a terminal is launched, the new prompt is used.
While the link provided above lists the most common components of
PS1
, look at this or this or just search the internet for much more.