Terminal Bell as Notification Mechanism

This how I know when long-running commands finish in the terminal. (I wrote this up very briefly in 2013.)

Why?

I want a way to know when long-running commands complete, or when specific commands complete. This should work whether the commands are running on my local machine, or whether I’m ssh’d into a remote host. If a build or backup command is going to take 15 minutes, it’s very easy for me to forget it’s running for hours. This solves that problem.

Background

You can emit a terminal bell by writing the ASCII BEL character, like this:

echo -e '\a'

I keep a shell script in my local bin directory, called simply beep, that runs the echo command above.

If I know ahead of time I’m going to run a long-running command, I can type:

$ long-command; beep

Or, if I’ve already started long-command, I can just type beep in the terminal. It will run right after the current command finishes. (The terminal holds onto your keyboard input and sends it immediately at the next prompt.)

Terminal emulator setup

I use foot, so I set:

[bell]
notify=yes

This means foot sends notifications like this when the terminal bell rings:

(The exact styling depends entirely on how your system is set up. This is from a roughly stock dunst configuration.)

tmux setup

If you use the tmux terminal multiplexer, you must also configure it to allow any window to ring the bell. I also turn off the visual bell:

set-option -g bell-action any
set-option -g visual-bell off

You can also examine my full tmux.conf if it’s helpful.

Alternatives/additions


Previous Post: Automatically deploying a Hugo static website to S3 via sourcehut - 2026