How to use screen or tmux for persistent sessions

Answered
Jan 05, 2026 245 views 1 answers
17

My SSH session disconnects and kills my running processes. How can I keep them running?

O
Asked by omar_linux
Platinum 593 rep

1 Answer

30
# Using screen
screen -S mysession  # Create session
# Run your commands
Ctrl+A, D            # Detach
screen -r mysession  # Reattach

# Using tmux (recommended)
tmux new -s mysession  # Create
# Run commands
Ctrl+B, D              # Detach
tmux attach -t mysession  # Reattach

# List sessions
tmux ls
screen -ls
D
Answered by devops_guru 1 week, 2 days ago
Gold 290 rep

Your Answer

You need to be logged in to answer questions.

Log In to Answer

Hot Questions

No hot questions available.