Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Scripts for dynamic window titles in GNU Screen

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time


This is my method of enhancing the GNU Screen window titles. It relies on my interactive shell being /bin/bash.

These scripts will:

  • show a plain $ or # when just the shell (or root shell) is running in that window
  • show the name of a running command (so if you run nice top -d 10 it will show top)
  • prepend the title with # if the user is root, or the command is running with sudo
  • show, for selected commands, a filename in braces instead of the command. So running sudo vi /etc/fstab would show a title #{fstab}

Matthew Flint,


  • a machine where you routinely run GNU Screen...
  • ... and GNU Bash


Start by downloading the preexec tweak and stash it somewhere. The file doesn't need to be executable.

Now edit your .bashrc and add this at the end:

# setup preexec and precmd functions
. /home/user/path/to/preexec.bash

# load the screen preexec stuff
. /home/user/path/to/



I'm sure there will be bugs, and I'd be happy to receive pull requests ;-)

Something went wrong with that request. Please try again.