Terminal Multitasking with Tmux
As software developers, we use terminal emulators for tasks like compiling, version control, and remote machine management. Normally, we do these concurrently in different terminal windows.
Tmux is an alternative to GNU Screen that allows you to multiplex several virtual consoles in a single window, useful for running multiple CLI programs at the same time.
tmux package using your system’s package manager.
brew install tmux
sudo apt-get install -y tmux
git clone https://github.com/tmux/tmux.git cd tmux sh autogen.sh ./configure && make
Important: requires at least a working
pkg-config as well as
libraries and headers.
How to Use
tmux in your terminal to start a new session. The display will be cleared and a status bar with time and date will appear at the bottom
of the terminal screen indicating tmux is running.
You send commands to
tmux via shortcut keys, which are prefixed by
Ctrl-b. That is, you press the prefix (
Ctrl-b) keys first then the
desired shortcut command.
Below are the default basic commands in Tmux. This can be configured in a
tmux.conf file in your
Active windows are listed on the tmux status bar.
|Rename current window||
|Close current window||
|Last active window||
|Select window by number||
Panes are divisions/splits of independent virtual terminals inside a window.
|Split pane vertically||
|Split pane horizontally||
|Switch to last active pane||
|Move current pane left||
|Move current pane right||
|Switch to pane to the direction||
|Close current pane||
|Toggle pane zoom (aka maximize)||
|Move to next pane||
|Convert pane to window||
|Switch to pane by number||
|Enter command mode||
|Show shortcuts list||
For advanced shortcuts, you can visit this cheat sheet for reference.
This Arch Linux Wiki contains a comprehensive guide on how to configure your tmux setup such as adding or modifying shortcut keys, layouting tricks, Vim/Emacs keybinding, mouse support, etc.
Here’s a demo of tmux in action.