Add date and time to Linux terminal title (Gnome Terminal, xterm, urxvt, rxvt) - Comment Page: 1
Here is easy way add date and time to Linux terminal title. This trick works at least following terminals Gnome Terminal, xterm, urxvt, rxvt.
Simply type the following command line:
while sleep 1 ; do echo -ne '\033]2;'`date`'\007'; done &
this command is really nice but please explain this script.
Hi krish,
This is actually really simple:
1. While loop is simple, try following (prints date output on console every second):
2. Use echo without the trailing newline and enable interpretation of backslash escapes:
3. “\033]2;Title\007” syntax is used to change title of existing aixterm window, try following:
Finally all together outputs date and time to your terminal title. :)