wiki: add dev-tools section with tmux, screen, and rsync articles
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>
This commit is contained in:
102
03-opensource/dev-tools/rsync.md
Normal file
102
03-opensource/dev-tools/rsync.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# rsync — Fast, Resumable File Transfers
|
||||
|
||||
## Problem
|
||||
|
||||
Copying large files or directory trees between drives or servers is slow, fragile, and unresumable with `cp`. A dropped connection or a single error means starting over. You also want to skip files that already exist at the destination without re-copying them.
|
||||
|
||||
## Solution
|
||||
|
||||
`rsync` is a file synchronization tool that only transfers what has changed, preserves metadata, and can resume interrupted transfers. It works locally and over SSH.
|
||||
|
||||
### Installation (Fedora)
|
||||
|
||||
```bash
|
||||
sudo dnf install rsync
|
||||
```
|
||||
|
||||
### Basic Local Copy
|
||||
|
||||
```bash
|
||||
rsync -av /source/ /destination/
|
||||
```
|
||||
|
||||
- `-a` — archive mode: preserves permissions, timestamps, symlinks, ownership
|
||||
- `-v` — verbose: shows what's being transferred
|
||||
|
||||
**Trailing slash on source matters:**
|
||||
- `/source/` — copy the *contents* of source into destination
|
||||
- `/source` — copy the source *directory itself* into destination
|
||||
|
||||
### Resume an Interrupted Transfer
|
||||
|
||||
```bash
|
||||
rsync -av --partial --progress /source/ /destination/
|
||||
```
|
||||
|
||||
- `--partial` — keeps partially transferred files so they can be resumed
|
||||
- `--progress` — shows per-file progress and speed
|
||||
|
||||
### Skip Already-Transferred Files
|
||||
|
||||
```bash
|
||||
rsync -av --ignore-existing /source/ /destination/
|
||||
```
|
||||
|
||||
Useful when restarting a migration — skips anything already at the destination regardless of timestamp comparison.
|
||||
|
||||
### Dry Run First
|
||||
|
||||
Always preview what rsync will do before committing:
|
||||
|
||||
```bash
|
||||
rsync -av --dry-run /source/ /destination/
|
||||
```
|
||||
|
||||
No files are moved. Output shows exactly what would happen.
|
||||
|
||||
### Transfer Over SSH
|
||||
|
||||
```bash
|
||||
rsync -av -e ssh /source/ user@remotehost:/destination/
|
||||
```
|
||||
|
||||
Or with a non-standard port:
|
||||
|
||||
```bash
|
||||
rsync -av -e "ssh -p 2222" /source/ user@remotehost:/destination/
|
||||
```
|
||||
|
||||
### Exclude Patterns
|
||||
|
||||
```bash
|
||||
rsync -av --exclude='*.tmp' --exclude='.Trash*' /source/ /destination/
|
||||
```
|
||||
|
||||
### Real-World Use
|
||||
|
||||
Migrating ~286 files from `/majorRAID` to `/majorstorage` during a RAID dissolution project:
|
||||
|
||||
```bash
|
||||
rsync -av --partial --progress --ignore-existing \
|
||||
/majorRAID/ /majorstorage/ \
|
||||
2>&1 | tee /root/raid_migrate.log
|
||||
```
|
||||
|
||||
Run inside a `tmux` or `screen` session so it survives SSH disconnects:
|
||||
|
||||
```bash
|
||||
tmux new-session -d -s rsync-migrate \
|
||||
"rsync -av --partial --progress /majorRAID/ /majorstorage/ | tee /root/raid_migrate.log"
|
||||
```
|
||||
|
||||
### Check Progress on a Running Transfer
|
||||
|
||||
```bash
|
||||
tail -f /root/raid_migrate.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Tags
|
||||
|
||||
#rsync #linux #storage #file-transfer #sysadmin #dev-tools
|
||||
76
03-opensource/dev-tools/screen.md
Normal file
76
03-opensource/dev-tools/screen.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# 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
|
||||
93
03-opensource/dev-tools/tmux.md
Normal file
93
03-opensource/dev-tools/tmux.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# tmux — Persistent Terminal Sessions
|
||||
|
||||
## Problem
|
||||
|
||||
SSH sessions die when your connection drops, your laptop closes, or you walk away. Long-running jobs — storage migrations, file scans, downloads — get killed mid-run. You need a way to detach from a session, come back later, and pick up exactly where you left off.
|
||||
|
||||
## Solution
|
||||
|
||||
`tmux` is a terminal multiplexer. It runs sessions that persist independently of your SSH connection. You can detach, disconnect, reconnect from a different machine, and reattach to find everything still running.
|
||||
|
||||
### Installation (Fedora)
|
||||
|
||||
```bash
|
||||
sudo dnf install tmux
|
||||
```
|
||||
|
||||
### Core Workflow
|
||||
|
||||
```bash
|
||||
# Start a named session
|
||||
tmux new-session -s mysession
|
||||
|
||||
# Detach from a session (keeps it running)
|
||||
Ctrl+b, d
|
||||
|
||||
# List running sessions
|
||||
tmux ls
|
||||
|
||||
# Reattach to a session
|
||||
tmux attach -t mysession
|
||||
|
||||
# Kill a session when done
|
||||
tmux kill-session -t mysession
|
||||
```
|
||||
|
||||
### Start a Background Job Directly
|
||||
|
||||
Skip the interactive session entirely — start a job in a new detached session in one command:
|
||||
|
||||
```bash
|
||||
tmux new-session -d -s rmlint2 "rmlint /majorstorage// /mnt/usb// /majorRAID 2>&1 | tee /majorRAID/rmlint_scan2.log"
|
||||
```
|
||||
|
||||
The job runs immediately in the background. Attach later to check progress:
|
||||
|
||||
```bash
|
||||
tmux attach -t rmlint2
|
||||
```
|
||||
|
||||
### Capture Output Without Attaching
|
||||
|
||||
Read the current state of a session without interrupting it:
|
||||
|
||||
```bash
|
||||
tmux capture-pane -t rmlint2 -p
|
||||
```
|
||||
|
||||
### Split Panes
|
||||
|
||||
Monitor multiple things in one terminal window:
|
||||
|
||||
```bash
|
||||
# Horizontal split (top/bottom)
|
||||
Ctrl+b, "
|
||||
|
||||
# Vertical split (left/right)
|
||||
Ctrl+b, %
|
||||
|
||||
# Switch between panes
|
||||
Ctrl+b, arrow keys
|
||||
```
|
||||
|
||||
### Real-World Use
|
||||
|
||||
On **majorhome**, all long-running storage operations run inside named tmux sessions so they survive SSH disconnects:
|
||||
|
||||
```bash
|
||||
tmux new-session -d -s rmlint2 "rmlint ..." # dedup scan
|
||||
tmux new-session -d -s rsync-migrate "rsync ..." # file migration
|
||||
tmux ls # check what's running
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## tmux vs screen
|
||||
|
||||
Both work. tmux has better split-pane support and scripting. screen is simpler and more universally installed. I use both — tmux for new jobs, screen for legacy ones. See the [screen](screen.md) article for reference.
|
||||
|
||||
---
|
||||
|
||||
## Tags
|
||||
|
||||
#tmux #terminal #linux #ssh #productivity #dev-tools
|
||||
@@ -6,7 +6,9 @@ A curated collection of my favorite open-source tools and privacy-respecting alt
|
||||
- [rmlint: Duplicate File Scanning](productivity/rmlint-duplicate-scanning.md)
|
||||
|
||||
## 🛠️ Development Tools
|
||||
- *Coming soon*
|
||||
- [tmux: Persistent Terminal Sessions](dev-tools/tmux.md)
|
||||
- [screen: Simple Persistent Sessions](dev-tools/screen.md)
|
||||
- [rsync: Fast, Resumable File Transfers](dev-tools/rsync.md)
|
||||
|
||||
## 🎨 Media & Creative
|
||||
- *Coming soon*
|
||||
|
||||
Reference in New Issue
Block a user