If Not True Then False

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 &
Categories:

2 Comments

Leave a Comment

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

Input your comment.
help

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=""> <s> <strike> <strong>

Input your name.

JR

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 Reply