Tmux
Cheatsheet and References
1. https://gist.github.com/MohamedAlaa/2961058
2. https://tmuxcheatsheet.com/
Tmux Guide
Quelle: https://linuxize.com/post/getting-started-with-tmux/
Starting Your First Tmux Session
To start your first Tmux session, simply type tmux in your console:
tmux
This will open a new session, create a new window, and start a shell in that window.
Once you are in Tmux you’ll notice a status line at the bottom of the screen which shows information about the current session.
You can now run your first Tmux command. For example, to get a list of all commands, you would type:
Ctrl+b ?
Creating Named Tmux Sessions
By default, Tmux sessions are named numerically. Named sessions are useful when you run multiple Tmux sessions. To create a new named session, run the tmux command with the following arguments:
tmux new -s session_name
It’s always a good idea to choose a descriptive session name.
Detaching from Tmux Session
You can detach from the Tmux session and return to your normal shell by typing:
Ctrl+b d
The program running in the Tmux session will continue to run after you detach from the session.
Re-attaching to Tmux Session
To attach to a session first, you need to find the name of the session. To get a list of the currently running sessions type:
tmux ls
The name of the session is the first column of the output.
0: 1 windows (created Sat Sep 15 09:38:43 2018) [158x35]
my_named_session: 1 windows (created Sat Sep 15 10:13:11 2018) [78x35]
As you can see from the output, there are two running Tmux sessions. The first one is named 0 and the second one my_named_session.
For example, to attach to session 0, you would type:
tmux attach-session -t 0
Working with Tmux Windows and Panes
When you start a new Tmux session, by default, it creates a single window with a shell in it.
To create a new window with shell type Ctrl+b c, the first available number from the range 0...9 will be assigned to it.
A list of all windows is shown on the status line at the bottom of the screen.
Below are some most common commands for managing Tmux windows and panes:
Ctrl+bcCreate a new window (with shell)Ctrl+bwChoose window from a listCtrl+b0Switch to window 0 (by number )Ctrl+b,Rename the current windowCtrl+b%Split current pane horizontally into two panesCtrl+b"Split current pane vertically into two panesCtrl+boGo to the next paneCtrl+b;Toggle between the current and previous paneCtrl+bxClose the current pane
Kommando in eine Terminal Session schicken (in den Hintergrund)
tmux new-session -d -s SESSIONNAME 'Befehl'