Add date and time to Linux terminal title (Gnome Terminal, xterm, urxvt, rxvt)

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 &

Follow If Not True Then False Updates!

2 Comments

  1. 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):

      while sleep 1; do echo `date`; done;

      2. Use echo without the trailing newline and enable interpretation of backslash escapes:

      echo -ne "test"

      3. “\033]2;Title\007″ syntax is used to change title of existing aixterm window, try following:

      echo -ne "\033]2;This is my own title\007" &

      Finally all together outputs date and time to your terminal title. :)

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>