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 &

2 comments on “Add date and time to Linux terminal title (Gnome Terminal, xterm, urxvt, rxvt) - Comment Page: 1

    1. this command is really nice but please explain this script.

      Reply
      • 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. :)

        Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close