Aaron Perry
Aaron Perry

Reputation: 1051

Displaying Live Time In The Top Of Terminal

I'm currently looking for a way to display the current time/date at the top of my terminal and then have it update, for instance if I use "date +%H%m%s" and then the seconds would update live.

Upvotes: 1

Views: 766

Answers (1)

chepner
chepner

Reputation: 532313

Add this to your .bashrc:

while true; do
    printf '\e]0;%s\a' $(date +%T)
    sleep 1
done &

This creates a background shell process which changes the terminal window title bar text to the current time once per second.

Upvotes: 1

Related Questions