In this tutorial, let’s learn some basics of tmux
, to get started
right away.
What Is Tmux
Tmux is a window multiplexer, which allows you to have multiple terminal sessions within a single terminal window or to detach and reattach sessions.
To install tmux, just type the following command:
sudo apt install tmux (Debian based systems)
sudo pacman -S tmux (Arch based systems)
sudo dnf -y install tmux (Fedora)
After installation, just type tmux
to get started.
*
- asterisk represents the current window.0
- window 0.bash
- name of the window.
To open a new window pane:
Ctrl+b %
To open a window pane at the bottom:
Ctrl+b "
To move in between panes:
Ctrl+b -> <- (left and right arrows on your keyboard)
To close the panes:
exit
You can also have multiple windows. In order to open a new window,type the following command:
Ctrl+b c
In order to edit a window name, use:
Ctrl+b ,
To switch between windows:
Ctrl+b 0
You can also have multiple sessions in tmux. When you start tmux, you start a tmux session. Sessions help you preserve the current state.
To start a new session, type the following command:
tmux new -s docker
To see what sessions are running or active:
tmux ls
You can also attach or detach sessions.
To attach a session:
tmux attach -t 0
Here, `-t` is target and `0` is the name of the session.
To detach a session:
Ctrl+b d
You can also rename sessions.
tmux rename-session -t 0 git
Here, we are renaming session `0` to `git`.
Finally, if you want to kill sessions, type the following command:
tmux kill-session -t git
Here, `git` is the name of the session.
Follow me on other social media