Search

Changing the terminal prompt to date

The standard prompt in most of the terminals is "username@computername" or some thing similar to it.
But this can be changed easily, just by setting a variable "PS1".
To change it temporarily open a terminal and type



and you will see the prompt change to hello.
But how about making the prompt a little more sensible, like the date.

To change the prompt to the current date run the following command in a terminal



These changes are temporary and will be lost as soon as the terminal is closed.
To make them permanent add them into the ~/.bashrc file.
Either you can look for the line where PS1 gets set to the default value in the .bashrc file or just over ride the previous assignment by adding the new assignment at the end of the file.

2 comments: