Last active
February 10, 2025 18:47
-
-
Save michaeltelford/78c483e0b7c9cb719a0878661a644932 to your computer and use it in GitHub Desktop.
Linux tmux cheatsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Linux tmux is used as a session manager to persist processes started from a SSH connection (which are killed | |
| # by default on disconnect). | |
| # Start a tmux session, then a daemon process and exit the session (which keeps the daemon running): | |
| # ssh -i <foobar>.pem <ip-address>:22 | |
| tmux | |
| # start a process with <cmd &> to start a daemon | |
| Ctrl+B and then D # to exit the session | |
| tmux ls # to view running sessions | |
| tmux kill-session -t 0 # 0 here is the first tmux session in tmux ls but it might be different | |
| tmux attach-session -t 0 # 0 here is the first tmux session in tmux ls but it might be different | |
| # Killing a tmux session kills all processes started within it e.g. nginx server daemon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another alternative is
nohupe.g.Starts the exe/script in it's own (daemon) process and writes output to log file. STDERR is redirected to STDOUT so both end up in the log file.