Linux for Developers
/Advanced
tmux
Definition
Terminal Multiplexer. A software application that allows multiple terminal sessions to be accessed simultaneously in a single window, and keeps terminal sessions running in the background even if you disconnect.
Explain Like I'm New
Tabs and windows for your terminal, plus a safety net. If your Wi-Fi drops while you are running a 3-hour script, `tmux` keeps the script running safely on the server. When Wi-Fi comes back, you reconnect and the script is right where you left it.
Real World Example
An engineer opens `tmux`. They split the screen in half. On the left, they run the Node server. On the right, they watch the log files using `tail -f`. They close their laptop, go home, open it back up, SSH in, type `tmux attach`, and both screens are still running perfectly.
Common Use Cases
- •Protecting long-running scripts from network drops
- •Managing complex workspaces via SSH
Interview Questions
basic
- If you start a command inside `tmux` and then accidentally close your terminal window, does the command die?
intermediate
- What is the 'Prefix Key' in tmux?