Skip to main content
DARKPC.NET

Use a Separate Tmux Socket for Testing Configuration

Load a trial tmux configuration into a separate local server and confirm the everyday server retains its own settings.

Difficulty Intermediate

Prerequisites

Use a terminal with tmux installed. Run these examples from outside tmux. Choose a socket name used only for this exercise. The -L flag identifies a separate server socket and must be supplied for each trial command.

Create a small trial configuration

Work in an empty practice directory and use a visually distinctive status setting.

cat > trial.conf <<'CONFIG'
set -g status-position top
set -g status-style 'bg=colour22,fg=white'
CONFIG
tmux -L darkpc-config-trial -f "$PWD/trial.conf" new-session -d -s preview
tmux -L darkpc-config-trial show-options -gv status-position
tmux -L darkpc-config-trial list-sessions

Expect top and one session called preview. A normal tmux list-sessions queries the normal socket. It may list your everyday sessions or report that the default server is absent.

Inspect and reload

tmux -L darkpc-config-trial attach-session -t preview

Check the top status line and detach with Ctrl+B then D. Set status-position bottom in trial.conf and reload with tmux -L darkpc-config-trial source-file "$PWD/trial.conf". Ask show-options for status-position again and compare.

Troubleshooting and practice

The -f option is read when a new server starts. If you reused a socket with a running trial server, use source-file for deliberate changes or choose another unused lab socket. Test configuration fragments you understand because a tmux configuration can run shell commands. When finished, type exit in the trial session's only pane. Confirm that the named trial server exits and any ordinary tmux session still exists. Avoid running kill-server against an unqualified default socket during this exercise.

References and related reading