tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal. Tmux is available on Linux and BSD systems.
Let's dive into TMUX usage ...
tmux
Start new session of terminal multiplexer on the host with shell, specifically bash in following example in Ubuntu. It will be session 0.
![]() |
bash in tmux session 0 |
tmux new-session vi
Start new session of terminal multiplexer on the host with VI editor.
![]() |
vi in tmux sesson 3 |
tmux ls
List all sessions managed by the host.
dpasek@ubuntu-cra-vbox:~$
tmux ls
0: 1 windows (created Wed Sep 24 09:24:21 2025) (attached) 1: 1 windows (created Wed Sep 24 09:28:33 2025) (attached) 3: 1 windows (created Wed Sep 24 09:40:48 2025) (attached) dpasek@ubuntu-cra-vbox:~$
tmux
Start another session of terminal multiplexer on the host. It will be session 0.
tmux ls
List all sessions managed by the host.
dpasek@ubuntu-cra-vbox:~$
tmux ls
0: 1 windows (created Wed Sep 24 09:24:21 2025) (attached) 1: 1 windows (created Wed Sep 24 09:28:33 2025) (attached) dpasek@ubuntu-cra-vbox:~$
tmux a -t 0
Connect to tmux session 0 and if there are two connections into one session you share the terminal (aka screen) from two places. Pretty handy in case of pair programming, pair troubleshooting, mentoring, teaching, you name it.
![]() |
Sharing terminal between two users |
To detach from a tmux session (leave it running in the background but return to your normal shell), press Ctrl+b d
- Ctrl+b is the prefix key in tmux (you hold Ctrl and press b)
- Then press d for detach
Conclusion
Pretty handy *nix tool which improves your productability as IT expert.
No comments:
Post a Comment