In this short article we will cover some tools that allow you to split up your terminal into multiple zones or areas. This is convenient for those who want to create multiple running shells within the
same terminal screen.
The tmux utility enables you to run tasks without interruption on different servers allowing you to disconnect and connect without disrupting ongoing tasks.
On Linux/Ubuntu and similar distros, run the following command to install tmux :
apt install tmux
Once your tmux is installed, you would be able to break your terminal into multiple sessions, windows or panes.
Where a session can have multiple windows each of which is a single view that can further be divided up into panes.
Once tmux has been installed, you can run it by simply calling tmux. This will take you to a new session. In order to switch back to the previous session, you would just need to exit the new one.
Run the shortcut CTRL-b+d in order to detach from a session .This will allow you to not to lose your current ongoing task . Re-attaching will resume your work where you left off. This is quite useful if you have a remote task running on a distant server and you do not want to lose it when the connection drops.
You could also type in tmux detach in the command line :
The command below, will show all tmux sessions on your system :
Once you have the list of sessions, you have the possibility to connect to either of them by session number or by name.
tmux attach -t 0
tmux attach -t your_session_name
To kill a session , run the command below :
tmux kill-session -t your_session_name
Here is a quick reference of the shortcuts :
Use the following with CTRL-b shortcut :
In order to install and use screen, refer to our article :
How to use the screen command on Linux to keep your remote task running when the connection drops
You can split up your terminal with the help of the screen terminal multiplexer. Use the following shortcuts :
- Vertical splitting: CTRL + |.
- Horizontal splitting: CTRL + S
- Un-splitting: CTRL + Q
- View switching: CTRL + tab
After splitting has been done, go to the new area or region and launch a new session using CTRL + c before you can actually use that area.
Basic shortcuts for editing:
- Create new terminal: CTRL + c.
- Switch to the next terminal: CTRL + space.
- Switch back to the previous terminal: CTRL + backspace.
- Switch to the n’th terminal CTRL + [n]. (n should be between 0 and 9)
The tmux utility is similar to the screen tool but it is more advanced since it is client/server based and supports both vim and emacs shortcuts. You could also auto rename windows using tmux .