70

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?

Chai T. Rex
  • 5,333
Al Bundy
  • 911
  • 2
    The [TAB] key is already used for auto completition in the terminal. If you were to swich the instances by e.g. [ALT]+[TAB], it really would be easier to use positioned windows instead as suggested by @Zacharee1 . – Peter Nerlich Apr 21 '15 at 17:38
  • 2
    If you're very serious about this, check out some tiling window managers such as Xmonad or Awesome. – leftaroundabout Apr 21 '15 at 23:02
  • 1
    I would have to open multiple terminals and resize it everytime I start working. It would kill one of the best advantage of Linux: customizability. – Al Bundy Apr 22 '15 at 06:27
  • 1
    try guake or yakuake – rpax Apr 22 '15 at 12:30
  • 1
    use uxterm as terminal emulator (sudo apt-get install xterm), it’s the Unix standard, and you can invoke it multiple times and arrange them on the display as you see fit – mirabilos Apr 22 '15 at 12:53

12 Answers12

120

You need Terminator:

sudo apt-get install terminator

Terminator 4 windows

For 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
A.B.
  • 92,275
  • 1
    Note you can also assign the terminator ... command to Ctrl+Alt+T in Keyboard Settings > Shortcuts – Wilf Apr 21 '15 at 18:41
  • Is there any way to set which terminal window is active after start ?? When I launch it active window is at the bottom and I would like active terminal window to be at the top but I cant handle it. – Al Bundy Apr 21 '15 at 22:13
  • 3
    Unfortunately I can't recommend Terminator these days. As cool as it used to be, the project is now pretty much unmaintained, and uses an ancient (~4 years old) version of VTE (which is the widget doing the actual terminal emulation). That is, while it's cool to have many windows next to each other, what's happening inside each window will suffer from many issues. See also https://bugs.launchpad.net/terminator/+bug/1030562 – egmont Apr 25 '15 at 11:42
  • @egmont https://code.launchpad.net/~gnome-terminator/terminator/gtk3 – A.B. Apr 25 '15 at 11:47
  • 2
    @A.B. yes I know, that branch contains my work :) While it uses the most recent and much better VTE, the UI around it (Terminator itself) is heavily work-in-progress with quite a few bugs that are not present in the default Gtk+-2 version.

    Your answer with the apt-get install terminator command clearly refers to the Gtk+-2 version that uses ancient VTE. For reference it's indeed useful to mention the Gtk+-3 version which is not yet stable and not yet shipped by Ubuntu, but someone might try out.

    – egmont Apr 25 '15 at 11:55
  • @egmont That you could write in the answer as a supplement. =) – A.B. Apr 25 '15 at 12:03
  • 4
    You need Terminator. Epic. – maryisdead Jul 13 '15 at 19:51
  • @maryisdead I should write "You need a Terminator" ;) – A.B. Jul 13 '15 at 19:52
  • worked and very useful :) – Kaidul Islam Dec 17 '16 at 07:04
  • Where can we see a list of all terminator shortcuts? UPDATE: found it! Right click --> Preferences --> Keybindings tab. – Gabriel Staples Jun 15 '20 at 22:12
  • 1
    Note that the "preferences" menu is accessed by right-clicking on the screen, and Ctrl + Shift + E splits vertically, or you can just select it from the right-click menu. – Gabriel Staples Jun 15 '20 at 22:15
  • terminator with a 2x2 view (4 terminals at once open in the same window) works GREAT for running ROS (the Robot Operating System), since ROS requires so many stinking terminals open to simultaneously run multiple processes! – Gabriel Staples Jun 16 '20 at 02:06
18

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.

pomsky
  • 70,797
D-E-N
  • 1,684
12

As 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.

Léo Lam
  • 1,012
  • 3
  • 12
  • 27
10

Personally, 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:

https://github.com/tmux/tmux

Edit: JoKeR pointed out that you can install tmux with apt-get:

$ sudo apt-get install tmux
Vijay
  • 103
Grant Hulegaard
  • 201
  • 1
  • 3
8

You can use tmux, a terminal multiplexer.

sudo apt-get install tmux

For four panels you can use this script 4pSession, create the script with

mkdir -p ~/bin
touch ~/bin/4pSession
chmod +x ~/bin/4pSession
nano ~/bin/4pSession

and 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
fi

Than you can create a desktop file:

nano ~/.local/share/applications/tmux.desktop

with 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

enter image description here

A.B.
  • 92,275
5

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:

  1. Run sudo apt-get install compizconfig-settings-manager.
  2. Run sudo ccsm or search ccsm in Unity Dash.
  3. Scroll down until you find Grid, under Window Management. Make sure it is enabled.
  4. Go to the Corners / Edges tab and change the Corner options to their corresponding corners.
Volker Siegel
  • 13,315
TheWanderer
  • 19,523
  • 12
  • 52
  • 65
  • 3
    Then I am not able to look at all tabs in the same time and I have to resize it everytime I open terminal. – Al Bundy Apr 21 '15 at 17:40
  • @Bundy there is a way to make it so windows resize to a quarter of the screen when dragged to a corner. Let me find it, and I'll add it to my answer. – TheWanderer Apr 21 '15 at 18:19
1

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.

  • 1
    Please [edit] your answer, if you want to add information. – David Foerster Apr 27 '15 at 19:04