How to set up alerts and monitoring in tmux?

Quick Answer

Enable monitoring with Ctrl+b : then setw monitor-activity on to get alerts when background windows have activity. Use monitor-silence 30 to alert after 30 seconds of inactivity.

setw monitor-activity on

Detailed Explanation

Tmux can monitor background windows for activity, bell events, and silence periods, showing visual indicators in your status bar. This is useful for tracking build processes, server logs, or any long-running tasks.

Types of Monitoring

# Activity - any output in background windows
setw monitor-activity on

# Bell events - when programs ring the terminal bell
setw monitor-bell on

# Silence - alert after X seconds of no activity
setw monitor-silence 30

Global Configuration

Enable monitoring for all new windows by adding to ~/.tmux.conf:

# Enable all monitoring types globally
set-window-option -g monitor-activity on
set-window-option -g monitor-bell on  
set-window-option -g monitor-silence 60

# Enable visual notifications
set-option -g visual-activity on
set-option -g visual-bell on

Visual Indicators

When monitoring detects events, tmux highlights the window in your status bar. You can customize these indicators:

# Customize activity highlighting
set-window-option -g window-status-activity-style bg=red,fg=white

# Add symbols to window names
set-window-option -g window-status-format '#I:#W#{?window_activity_flag,!,}'

Pro Tip

Use silence monitoring for build processes: setw monitor-silence 30 will alert you when your build finishes and stops producing output.

Common Use Cases

  • Development: Monitor test runners, file watchers, dev servers
  • System Admin: Watch log files, server processes
  • Build Monitoring: Get notified when compilation finishes
  • SSH Sessions: Track activity on remote servers