How to display more than 1 terminal simultaneously
Sometimes when I work, I use more than one terminal and I find it inconvenient to switch between them when all of them were invoked using Ctrl+Alt+T. Is there any program or terminal that after launching would provide me with 4 independent terminals each of them would occupy ¼ of the screen while making it easy to switch between them, for instance by using the Tab key?
712 Answers
You need Terminator:
sudo apt-get install terminatorFor four terminals at start-up, do the following:
- Start terminator
- Split the terminal Ctrl+Shift+O
- Split the upper terminal Ctrl+Shift+O
- Split the lower terminal Ctrl+Shift+O
- Open Preferences and select Layouts
- Click Add and enter a usefull layout name and Enter
- Close Preferences and Terminator
Open Terminator with this command:
terminator --maximise --layout=<your_layout_name>or with this command:
terminator --maximise --borderless --layout=<your_layout_name>
Jump between the terminal windows with Ctrl+Tab.
You can assign your personal terminator command to Ctrl+Alt+T in Keyboard Settings > Shortcuts. (Thx @Wilf)
Of course you can also create a terminator.desktop file. Copy the original desktop file and make your changes:
cp /usr/share/applications/terminator.desktop ~/.local/share/applications/
nano ~/.local/share/applications/terminator.desktop 12 You can start 4 Terminals with Ctrl+Alt+T and fit them to the edges of your screen with Ctrl+Alt+Numpad[1,3,7,9] or left/right with Ctrl+Alt+Numpad[4/6] or top/bottom Ctrl+Alt+Numpad[8/2] and switch with Alt+Tab to ONE Terminal and with Alt+key above Tab between the terminals if one is active.
Or
You can use tabs with Ctrl+Shift+T and switch between the terminals with Alt+Page-Up/Page-Down.
3As another alternative, I would suggest using byobu.
Byobu is a GPLv3 open source text-based window manager and terminal multiplexer. It was originally designed to provide elegant enhancements to the otherwise functional, plain, practical GNU Screen, for the Ubuntu server distribution. Byobu now includes an enhanced profiles, convenient keybindings, configuration utilities, and toggle-able system status notifications for both the GNU Screen window manager and the more modern Tmux terminal multiplexer, and works on most Linux, BSD, and Mac distributions.
The advantage is that it is text-based, meaning you can use it without a graphical environment! This is very useful when dealing with servers, which often don't have a GUI.
You even have a bottom status bar with a lot of useful information, like the date/time, the load average, etc.
The shortcuts you have to know if you use Byobu are:
- F2 creates a new tab.
- Shift+F2 creates a new split tab (this splits your current tab horizontally).
- F3 and F4 to switch between tabs.
- F9 to configure Byobu.
sudo apt-get install byobu will install Byobu.
As a bonus, being a terminal multiplexer, it means you won't lose your session and your tabs if you closed the terminal by mistake. And you can run byobu in another terminal and get synchronised outputs.
There are even scripts to save the layouts if you wish to persist the session across reboots.
1Personally, I use emacs with M-x ansi-term or M-x shell depending on what I am doing.
But if you are looking for just a terminal multiplexer then there is always the quietly revered tmux:
Edit: JoKeR pointed out that you can install tmux with apt-get:
$ sudo apt-get install tmux 2 Just resize your terminal windows, so they all fit a corner of the screen. The Terminal can also have tabs, which might help out. Right click the window and select New Tab.
Here's how to make windows able to resize to corners:
- Run
sudo apt-get install compizconfig-settings-manager. - Run
sudo ccsmor searchccsmin Unity Dash. - Scroll down until you find
Grid, underWindow Management. Make sure it is enabled. - Go to the
Corners / Edgestab and change theCorneroptions to their corresponding corners.
You can use tmux, a terminal multiplexer.
sudo apt-get install tmuxFor four panels you can use this script 4pSession, create the script with
mkdir -p ~/bin
touch ~/bin/4pSession
chmod +x ~/bin/4pSession
nano ~/bin/4pSessionand add the code below
#!/usr/bin/env bash
# if the session is already running, just attach to it.
tmux has-session -t 4panel
if [ $? -eq 0 ]; then sleep 1 tmux attach -t 4panel
else tmux new-session -d -s 4panel tmux split-window -v tmux split-window -h tmux select-pane -t 0 tmux split-window -h tmux select-pane -t 0 tmux -2 attach-session -d
fiThan you can create a desktop file:
nano ~/.local/share/applications/tmux.desktopwith this content:
[Desktop Entry]
Name=tmux
Comment=a terminal multiplexer
Exec=/<path_to_script>/4pSession
Icon=terminal
Terminal=true
Type=Application
Categories=Terminal;Move between the panes with Ctrl+B and than → or ← or ↑ or ↓
My crude contribution to this question: install wmctrl and adjust the script bellow,that opens and positions four terminal windows, to your screen.
First find out the size of your screen with xwininfo -root and then adjust -e parameters (they are in this order 0,x-position,y-position,width,height). Numbers I use bellow are just example
#!/bin/bash
# Author: Serg Kolo
# Date: 2/18/2015
# Description: Open 4 terminals and position them
gnome-terminal -t WINDOW-ONE &
gnome-terminal -t WINDOW-TWO &
gnome-terminal -t WINDOW-THREE &
gnome-terminal -t WINDOW-FOUR &
sleep 0.5
wmctrl -r WINDOW-ONE -e 0,0,0,500,250 &
sleep 0.5
wmctrl -r WINDOW-TWO -e 0,0,384,500,250 &
sleep 0.5
wmctrl -r WINDOW-THREE -e 0,500,0,500,250 &
sleep 0.5
wmctrl -r WINDOW-FOUR -e 0,500,384,500,250 &You could bind this as a shortcut, for instance to Ctrl+I or whatever. Another idea, without installing wmctrl, is to open 4 --geometry= option
I would strongly recommend tmux. It offers a whole lot of customizations and total independence from the mouse (if that is concern). You can split screens horizontally, vertically, switch between them with some keystrokes, leave sessions open and reconnect to them later, etc.
3With 4 terminal windows open, and while working in one of them, I can simply switch among them with Alt+` (left tick) if want to use keyboard, or simply click on the launcher icon of the terminal to bring up all its windows and click on the chosen one.
My installation is Ubuntu 14.04, with the default (Unity 3D) desktop, and updated to-date.
I don't get it why people complicate things and install 3rd party products when the default Ubuntu installation already provides the feature.
you can use Gnu Screen for this also, and use a vertical split, and horizontal split.
you can put these in your ~/.screenrc config file. I have been able to split using most any gnu screen, with proper adjustments to .screenrc file.
Some combo of below should do you in your .screenrc.
screen -t tl 1 bash
split
focus down
screen -t bl 3 bash
split -v
focus down
screen -t br 4 bash
select 1
split -v
focus down
screen -t tr 2 bashI had it set for 6 screen once. heres my residual config from that
30 ## 1 a local bash 31 # screen -t host03 1 bash 32 #sessinoname blamb1 33 34 ## 2 ssh to host04 35 # split -v 36 # focus 37 # select 2 38 # resize -6 39 # screen -t host04 2 ssh host04 40 # caption string "%{kk}XXXXXXX" 41 42 ## 3 bashed 43 # focus 44 # select 1 45 # split 46 # focus 47 # select 3 48 # screen -t bashed 3 bash 49 #exec ssh host04 50 # caption string "%{kk}XXXXXXX" 51 52 ## 4 bashedup 53 # split 54 # focus down 55 # screen -t bashedup 4 bash 56 # caption string "%{kk}XXXXXXX" 57 58 ## 5 compass 59 # split 60 # focus down 61 # resize -14 62 # screen -t compass 5 bash 63 # leave caption commented till resize works 64 #caption string "%{kk}XXXXXXX" 65 66 #focus up 67 68 69 ## 5mysql 70 # exec mysql -p 71 # screen -t mysql 5 mysql 72 73 ## 6php 74 # screen -t php.ini 6 vim /etc/php/php.ini 75 # select php.ini 76 # chdir /etc/php 77 # exec vim php.ini you can use the application "screen"
Install screen by running the following command:
apt-get install screenTo verify that screen has been installed, run
screen -vwithin a screen session, you can create a new window by pressing CTRL + A, then C. Your old window will remain active and you can perform other tasks. To switch between windows, press CTRL + A, then N (for the next window) or CTRL + A, then P
There are inbuilt shortcuts for this, and easy navigation too.
Ctrl + Alt + T - press once to start the 1st terminalCtrl + Shift + T - press 3 times, to get 3 more terminal as Tabs, within the same window of 1st terminalAlt + 1 or Alt + 2 or Alt + 3 or Alt + 4 - each will these will switch to corresponding tab/terminal.
Hope that helps.