Terminal Multiplexer: Tmux
Tmux is a powerful, configurable terminal multiplexer.
Tmux is a terminal multiplexing application that was created to overcome the limitations of using only one terminal.
It is a command-line utility that can run from the command line, this allows you to have multiple terminals open in one window. Also, it enables several processes to be run concurrently in separate terminals.
It is an indispensable tool for modern software developers who frequently use terminals.
Tmux is typically installed via the package manager. Open the terminal and run the following command to install tmux on mac:
brew install tmux
Tmux does not replace your existing shell or terminal applications but extends them by providing additional features to make working with multiple terminal windows easier.
The prefix key is an essential part of tmux, by default all of tmux’s key bindings sit behind a prefix.
C-b (control+b)
Sessions
- To start your first tmux session, run the below command
tmux new -s <session_name>
- Detach from a session, Prefix + d or tmux detach
- List sessions tmux ls
- Close a pane/window with either Ctrl + d or Prefix + x
Window
- Once the tmux session starts, you can create multiple windows inside the sessions.
tmux new -c <window_name>
- Switch a different window tmux new-window -n WINDOW or Prefix + c
- Kill a window with tmux kill-window -t WINDOW
- Close a pane/window with either Ctrl + d or Prefix + x
Tmux provides even more features like Pane, which splits the terminal into multiple small terminals. It helps to run commands, scripts, backups, and other processes.
Read more about tmux in Github.