zmx Session Manager
zmx keeps terminal sessions alive across SSH disconnects. Chosen over tmux because:
- Native terminal scrollback works (tmux breaks it)
- Terminal state fully restored on reattach (via libghostty-vt)
- No window management bloat — just persistent sessions
- Pre-built static aarch64 binary, zero dependencies
Version: 0.4.1
Binary: ~/.local/bin/zmx
Sockets/logs: /run/user/1000/zmx
Installation
curl -sL https://zmx.sh/a/zmx-0.4.1-linux-aarch64.tar.gz | tar -xz -C /tmp
mv /tmp/zmx ~/.local/bin/zmx
chmod +x ~/.local/bin/zmx
Shell integration
Add to ~/.bashrc:
# zmx: show session name in prompt (yellow)
if [[ -n $ZMX_SESSION ]]; then
export PS1="\[\033[01;33m\][zmx:$ZMX_SESSION]\[\033[00m\] ${PS1}"
fi
# zmx: bash completions
if command -v zmx &>/dev/null; then
source <(zmx completions bash)
fi
# zmx: auto-attach on SSH login
if [[ -n $SSH_CONNECTION && -z $ZMX_SESSION ]] && command -v zmx &>/dev/null; then
mapfile -t sessions < <(zmx list 2>/dev/null | sed 's/.*session_name=\([^ \t]*\).*/\1/')
if [[ ${#sessions[@]} -gt 0 ]]; then
echo ""
echo " zmx sessions:"
for i in "${!sessions[@]}"; do
echo " $((i+1))) ${sessions[$i]}"
done
echo " 0) skip"
echo ""
read -rp " attach to> " choice
if [[ "$choice" =~ ^[1-9][0-9]*$ ]] && (( choice <= ${#sessions[@]} )); then
exec zmx attach "${sessions[$((choice-1))]}"
fi
fi
fi
The prompt shows [zmx:sessionname] in yellow when inside a session. Tab completion works for session names.
On SSH login, if zmx sessions are running, a picker is shown:
zmx sessions:
1) agent
2) dev
0) skip
attach to>
Pick a number to attach, or 0 / Enter to skip to a normal shell. Uses exec so the shell is replaced by zmx — no dangling parent shell.
Usage
Attach to a session (create or resume)
zmx attach agents
Detach from a session
- Close the terminal window, or
- Press
Ctrl+\, or - Run
zmx detach
List running sessions
zmx list
View scrollback without attaching
zmx history agents
Kill a session
zmx kill agents
Notes
- Sessions live in
/run/user/1000/zmx— a user runtime directory. They survive SSH disconnects but not reboots. After a reboot, start sessions fresh withzmx attach <name>. - zmx is used on
outpost-pi(aarch64 Raspberry Pi) for running long-lived AI coding agent sessions.
Alternatives considered
| Tool | Why not chosen |
|---|---|
| tmux | Breaks native scrollback; more window management than needed |
| amux | Web dashboard + watchdog for Claude Code on top of tmux; requires tmux, overkill for now |