-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux tmux screen Guide
Complete beginner-friendly guide to tmux and screen on Linux, covering Arch Linux, CachyOS, and other distributions including terminal multiplexing, session management, and remote work.
- Understanding Terminal Multiplexers
- tmux Installation
- tmux Basics
- tmux Advanced
- screen Installation
- screen Basics
- Troubleshooting
Terminal multiplexers allow multiple terminal sessions in one window.
Benefits:
- Multiple sessions: Run several programs simultaneously
- Detach/reattach: Keep sessions running after disconnecting
- Split panes: Divide terminal into multiple areas
- Remote work: Essential for SSH sessions
Common uses:
- SSH sessions: Keep work running after disconnect
- Development: Multiple terminals for coding
- System administration: Monitor multiple services
Arch/CachyOS:
# Install tmux
sudo pacman -S tmuxDebian/Ubuntu:
sudo apt install tmuxFedora:
sudo dnf install tmuxStart tmux:
# Start new session
tmux
# Start named session
tmux new -s mysessionDefault prefix: Ctrl+b
Basic commands:
- Prefix + c: Create new window
- Prefix + n: Next window
- Prefix + p: Previous window
- Prefix + %: Split vertically
- Prefix + ": Split horizontally
- Prefix + d: Detach session
Manage sessions:
# List sessions
tmux ls
# Attach to session
tmux attach -t mysession
# Kill session
tmux kill-session -t mysessionWindow management:
# Create window
Prefix + c
# Rename window
Prefix + ,
# Switch windows
Prefix + 0-9Pane management:
# Split vertically
Prefix + %
# Split horizontally
Prefix + "
# Switch panes
Prefix + arrow keys
# Resize pane
Prefix + Ctrl + arrow keysConfigure tmux:
# Create config
vim ~/.tmux.confCommon settings:
# Set prefix to Ctrl+a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Enable mouse
set -g mouse on
# Start windows at 1
set -g base-index 1
Arch/CachyOS:
# Install screen
sudo pacman -S screenDebian/Ubuntu:
sudo apt install screenFedora:
sudo dnf install screenStart screen:
# Start new session
screen
# Start named session
screen -S mysessionDefault prefix: Ctrl+a
Basic commands:
- Prefix + c: Create new window
- Prefix + n: Next window
- Prefix + p: Previous window
- Prefix + ": List windows
- Prefix + d: Detach session
- Prefix + A: Rename window
Manage sessions:
# List sessions
screen -ls
# Attach to session
screen -r mysession
# Detach (from inside)
Ctrl+a, d
# Kill session
screen -X -S mysession quitCheck installation:
# Check tmux
which tmux
tmux -V
# Install if missing
sudo pacman -S tmuxRecover session:
# List sessions
tmux ls
# Attach to session
tmux attach
# Force attach
tmux attach -dThis guide covered tmux and screen installation, basic usage, and session management for Arch Linux, CachyOS, and other distributions.
- Terminal Emulators - Terminal applications
- SSH Configuration - SSH setup
- tmux: https://github.com/tmux/tmux
- screen: https://www.gnu.org/software/screen/
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.