Add Time To Your Terminal

As those of you who follow my little slice of the net know, I have a severely autistic adult son. I run a couple of scripts remotely via secure shell, to keep an eye on what he is doing on his Linux laptop, which lets me make sure he’s not getting into mischief!

I found that one of my scripts would die every now and then, usually because my son would reboot his machine, or lose his WiFi connection briefly.

Wanting to know when the script stopped running, I decided it was time to add a time stamp to my terminal.

This is very easy to do. Just navigate to your home directory, and edit the .bashrc file, which holds your terminal configuration options.

Simply add the following line anywhere in the file:

PROMPT_COMMAND="echo -n \[\$(date +%F-%T)\]\ "

After you save the file, open a new terminal window and you’ll be greeted with a lovely time stamp!


Now we have the time in terminal.

Now we have the time in terminal.

The .bashrc config file has many other settings you can change, like the colors of the background and text, text size and lots of other goodies. Back up your original .bashrc file to another location, and experiment!