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.
Using tmux
The tmux Linux utility enables you to run tasks without interruption on different servers allowing you to disconnect and connect without disrupting ongoing tasks.
Installation of tmux
On Linux/Ubuntu and similar distros, run the following command to install tmux :
apt install tmux [Linux split screen utility installation]
Terminal split up
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.
Session creation
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.
Detaching from a session
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.
Read: How to Google search from Linux terminal : Build your own search engine
You could also type in tmux detach in the command line :
tmux detach [tmux split screen]
Display existing sessions
The command below, will show all tmux sessions on your system :
tmux ls
Attaching to an already existing session
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
Killing an existing session
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 :
Using screen
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
In a nutshell:
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)
Conclusion :
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 .
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.