Big clock in a terminal

Wednesday, October 14, 2020 · 1 minute · 181 words

How to show a big clock on Linux without using an application or having a browser opened on time.is ?

Just your terminal and a few commands and you’ll get someting like this :

A big clock all in text

It depends on figlet tool to make large character on terminal so you need to install it :

sudo apt install figlet

Then type in your terminal :

while true; do printf '\033[2J\033[H'; date +'%T' | figlet -ctW; sleep 1; done

Quick explanation :

while true; do ... ; done

This is how we define an infinite loop. (Ctrl+C to interrupt it)

printf '\033[2J\033[H'

Clear screen and fix the cursor position to top-left. For the record, the escape sequence \033[2J clear the entire screen and \033[H send the cursor at home. cf the Wikipedia page on ANSI escape code for other useful sequences.

date +'%T'

Output the time as hours:minutes:seconds (shortcut to %H:%M:%S).

| figlet -ctW 

Make large letters from the previous input. See the | befor it ? This means the previous command (date) is piped into figlet.

sleep 1

Wait for 1 second before looping.

linux shell terminal