Showing stuff in tmux/screen window title

tmux and screen handles the escape sequences
ESC k name ESC \ to set titles.

This can be helpful when running long scripts that produces lots of output (e.g. training a neural net). As a function in bash,

settitle(){
    printf "\033k$1\033\\"
}

or maybe from within python,

import sys
def settitle(name):
    sys.stdout.write("\033k{}\033\\".format(name))

This will work from C/C++ programs as well, by printing to stdout.

Show Comments