Add three new articles to 03-opensource/dev-tools/: - tmux: persistent terminal sessions, background jobs, capture-pane - screen: lightweight alternative, comparison table - rsync: flags reference, resumable transfers, SSH usage Update all indexes (SUMMARY, section index, main index, README). Article count: 28 → 31. Remove tmux from writing backlog. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
77 lines
1.7 KiB
Markdown
77 lines
1.7 KiB
Markdown
# screen — Simple Persistent Terminal Sessions
|
|
|
|
## Problem
|
|
|
|
Same problem as tmux: SSH sessions die, jobs get killed, long-running tasks need to survive disconnects. screen is the older, simpler alternative to tmux — universally available and gets the job done with minimal setup.
|
|
|
|
## Solution
|
|
|
|
`screen` creates detachable terminal sessions. It's installed by default on many systems, making it useful when tmux isn't available.
|
|
|
|
### Installation (Fedora)
|
|
|
|
```bash
|
|
sudo dnf install screen
|
|
```
|
|
|
|
### Core Workflow
|
|
|
|
```bash
|
|
# Start a named session
|
|
screen -S mysession
|
|
|
|
# Detach (keeps running)
|
|
Ctrl+a, d
|
|
|
|
# List sessions
|
|
screen -list
|
|
|
|
# Reattach
|
|
screen -r mysession
|
|
|
|
# If session shows as "Attached" (stuck)
|
|
screen -d -r mysession
|
|
```
|
|
|
|
### Start a Background Job Directly
|
|
|
|
```bash
|
|
screen -dmS mysession bash -c "long-running-command 2>&1 | tee /root/output.log"
|
|
```
|
|
|
|
- `-d` — start detached
|
|
- `-m` — create new session even if already inside screen
|
|
- `-S` — name the session
|
|
|
|
### Capture Current Output Without Attaching
|
|
|
|
```bash
|
|
screen -S mysession -X hardcopy /tmp/screen_output.txt
|
|
cat /tmp/screen_output.txt
|
|
```
|
|
|
|
### Send a Command to a Running Session
|
|
|
|
```bash
|
|
screen -S mysession -X stuff "tail -f /root/output.log\n"
|
|
```
|
|
|
|
---
|
|
|
|
## screen vs tmux
|
|
|
|
| Feature | screen | tmux |
|
|
|---|---|---|
|
|
| Availability | Installed by default on most systems | Usually needs installing |
|
|
| Split panes | Basic (Ctrl+a, S) | Better (Ctrl+b, ") |
|
|
| Scripting | Limited | More capable |
|
|
| Config complexity | Simple | More options |
|
|
|
|
Use screen when it's already there or for quick throwaway sessions. Use tmux for anything more complex. See [tmux](tmux.md).
|
|
|
|
---
|
|
|
|
## Tags
|
|
|
|
#screen #terminal #linux #ssh #productivity #dev-tools
|