tmux: Run a Command in a Detached Session
MediumCommand Line Essentials10-15 minA terminal multiplexer like tmux keeps sessions (and everything running in them) alive on a server even when no terminal is attached — so a long job survives you disconnecting, and you can reattach later to watch it. Keep a live tail of /root/deploy.log running inside a DETACHED tmux session named mon.
Use tmux new-session: start it detached so it needs no terminal (the -d flag), name the session mon (the -s flag), and hand it the tail command to run inside. Grading checks the tmux server, not your keystrokes. Verify with tmux ls, and reattach with tmux attach -t mon (then Ctrl-b, d to detach again). The gated hints have the full command if you get stuck.
- Create a detached tmux session named mon (tmux new-session -d -s mon …)
- Have it run tail -f /root/deploy.log inside the session
- Leave it running detached (so tmux ls shows it)
Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.
