editing .bashrc file to display name current date and time

748 Views Asked by At

how can I get my terminal to display MSU-[current date]-[current time]> using the bashrc? I want it to display my name the current date and the current time in the terminal. I have added a new PS1 line with that code in the gedit ~/.bashrc file but it isn't working. This is in the VMWARE workstation pro using ubuntu

1

There are 1 best solutions below

2
m19v On

You can use e.g. bashrcgenerator to generate PS1 with your wish elements, e.g. name, date, current folder etc.

Then paste it in to your .bashrc and source it:

source .bashrc

E.g.:

PS1="\u-[\d]-[\t]>\[$(tput sgr0)\]"

# which produces the look as follows:
# username-[Mon Feb 22]-[14:23:52]>