tmux is key to my development stack. It allows me to contain a lot of processes and activities into a single interface. I actually use two levels of tmux. Locally, I have a tmux session to manage my local activity. As a sysadmin, I have a need to connect to multiple servers, and I generally like to stay connected for easy access; however, due to the mobility of my laptop, it’s not generally practical to keep active connections.

To work around this, I use the excellent Mosh (mobile shell) utility out of MIT. My first tmux window is a mosh session to my own, personal VPS. From my VPS (which unlike my laptop is not mobile and is always connected), I have another tmux session whose windows are generally sessions out to other servers.

On a regular basis, I find that I need to start a long-running process, and I would like to have some passive way of knowing when it’s done. Enter the Terminal Bell. (Decimal 7 in the ASCII table). When a background window receives a terminal bell character, it will highlight itself (generally with an exclamation mark). I wasn’t able to find any existing, reliable method to generate this bell, so I wrote the simplest of C programs to achieve it:

#include <stdio.h>
int main()
  return 0;

On FreeBSD 10, compiling this is as simple as running:

cc beep.c -o /usr/local/bin/beep

(Or change cc to gcc if you’re using gcc.)

Now, when I invoke a long running process, I just append ; beep to the end of the command. I can see when the command completes now, because the tmux bar shows the ! in the status bar.

I’ve gisted the code as well, so you can just clone it to easy grab the source. Or you can grab the source here.