Screen and tmux Session Errors — Terminal Multiplexer Attachment and Detach Issues
Informationalcommand
Overview
Fix GNU Screen and tmux session errors including dead sessions, attachment failures, copy mode issues, and configuration file errors.
Key Details
- screen and tmux allow persistent terminal sessions that survive SSH disconnections
- Sessions can become 'dead' if the parent process crashes or the socket is removed
- Attachment errors occur when trying to attach to a session already attached elsewhere
- tmux uses a server-client architecture with a Unix socket for communication
- Configuration files: ~/.screenrc for screen, ~/.tmux.conf for tmux
Common Causes
- Session socket file deleted from /tmp or /run — session appears dead
- Trying to attach to a session already attached from another terminal without forcing
- tmux server crashed leaving orphaned sessions
- Configuration file syntax error preventing tmux/screen from starting
Steps
- 1List sessions: 'tmux ls' or 'screen -ls' to see running and dead sessions
- 2Force attach (tmux): 'tmux attach -d -t session_name' — the -d detaches other clients first
- 3Force attach (screen): 'screen -D -r session_name' — detaches and reattaches
- 4Kill dead sessions: 'tmux kill-session -t name' or 'screen -X -S name quit'
- 5Check config: 'tmux source-file ~/.tmux.conf' to reload and check for errors
Tags
tmuxscreenterminalmultiplexersession
More in Command
linux-exit-code-127Linux Exit Code 127 — Command Not Found
Warninglinux-exit-code-126Linux Exit Code 126 — Permission Denied
Warninglinux-segmentation-faultLinux Segmentation Fault (Signal 11)
Errorlinux-killed-signal-9Linux Process Killed (Signal 9)
Errorlinux-ansible-playbook-errorsAnsible Playbook Errors — Task Failures, SSH Connectivity, and Variable Resolution Issues
Warninglinux-terraform-errorsTerraform Errors — Plan, Apply, and State Management Failures
WarningFrequently Asked Questions
tmux is the modern choice — it has better default keybindings, native split panes, scriptable interface, and active development. screen is available on more legacy systems. Both serve the same core purpose.