How to use screen or tmux for persistent sessions

Answered
Jan 05, 2026 269 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 4 weeks, 1 day ago
Gold 290 rep

Your Answer

You need to be logged in to answer questions.

Log In to Answer

Related Questions

Hot Questions

No hot questions available.