Skip to content

Q&A · Answered

How to use screen or tmux for persistent sessions

asked 9 months, 1 week ago 746 views 1 answer
17

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

1 Answer

One accepted
30

Accepted answer

Not confirmed since it was written, 9 months, 1 week ago
# 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

Your answer

Say what you tried, not only what worked — the next person needs the reasoning. Code goes in a fenced block.

Shown beside your answer and never checked, so it cannot be a name someone already has here.

No account needed to answer. Sign in instead and it carries your name and earns reputation.