Linux Today: Linux News On Internet Time.

More on LinuxToday

CLI Magic: Use ANSI Escape Sequences to Display a Clock in Your Terminal

Jan 23, 2008, 07:00 (0 Talkback[s])
(Other stories by Sergio Gonzalez Duran)


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

"When I'm in a Linux terminal, I often find myself typing date just to see the time. To make life a bit easier, I wrote a script to always display a clock in the top right corner of the screen.

"The script saves the current cursor position with an ANSI escape sequence instruction. Then, using the tput command, the cursor is sent to row 0 (the top of the screen) and the last column minus 19 characters (19 is the length of HH:MM:SS YYYY-MM-DD)..."

Complete Story

Related Stories: