Tmux
Tmux is a terminal multiplexer; it allows you to create several "pseudo terminals" from a single terminal. This is very useful for running multiple programs with a single connection, such as when you’re remotely connecting to a machine using SSH or for running long running scripts that would stop once you close your connection.
For a short intro see https://www.redhat.com/sysadmin/introduction-tmux-linux
Install via sudo apt-get install tmux (or any other package manager)
Open a new session via
tmux
Use the shortcut Ctrl+B then D to detach from tmux.
To look at all running sessions with their ID/index use the ls command. If you have only one, then it will be session 0.
tmux ls
To reattach to a running session use the ID/index like this.
tmux attach -t 0
Enter a session and type exit to leave and close it.
Stopping the currently running task can be done like usual via the shortcut Ctrl+C.
This is a summary of all useful shortcuts:
-
Ctrl+B D — Detach from the current session.
-
Ctrl+B % — Split the window into two panes horizontally.
-
Ctrl+B " — Split the window into two panes vertically.
-
Ctrl+B Arrow Key (Left, Right, Up, Down) — Move between panes.
-
Ctrl+B X — Close pane.
-
Ctrl+B C — Create a new window.
-
Ctrl+B N or P — Move to the next or previous window.
-
Ctrl+B 0 (1,2…) — Move to a specific window by number.
-
Ctrl+B : — Enter the command line to type commands. Tab completion is available.
-
Ctrl+B ? — View all keybindings. Press Q to exit.
-
Ctrl+B W — Open a panel to navigate across windows in multiple sessions.
Leave a Reply
You must be logged in to post a comment.