69

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?

5
  • 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 . Apr 21, 2015 at 17:38
  • 2
    If you're very serious about this, check out some tiling window managers such as Xmonad or Awesome. Apr 21, 2015 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, 2015 at 6:27
  • 1
    try guake or yakuake
    – rpax
    Apr 22, 2015 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, 2015 at 12:53

12 Answers 12

119

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
12
  • 1
    Note you can also assign the terminator ... command to Ctrl+Alt+T in Keyboard Settings > Shortcuts
    – Wilf
    Apr 21, 2015 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, 2015 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 bugs.launchpad.net/terminator/+bug/1030562
    – egmont
    Apr 25, 2015 at 11:42
  • 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, 2015 at 11:55
  • 4
    You need Terminator. Epic.
    – maryisdead
    Jul 13, 2015 at 19:51
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.

3
  • 3
    Under which desktop environment does the Ctrl+Shift+Numpad work?
    – Wilf
    Apr 21, 2015 at 18:42
  • I've a standard Ubuntu installation with Unity
    – D-E-N
    Apr 22, 2015 at 22:24
  • It's Ctrl+Alt+Numpad Jan 10, 2017 at 23:08
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.

1
  • 1
    byobu domain url changed to byobu.org
    – Vijay
    Aug 27, 2019 at 6:08
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
2
  • 2
    you can install tmux with: sudo apt-get install tmux you should mention that I guess.
    – JoKeR
    Apr 21, 2015 at 18:52
  • 1
    Never used tmux myself, just know about it. Thanks for the clarification though I'll put it up top. Apr 21, 2015 at 18:59
6

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

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.
2
  • 2
    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, 2015 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. Apr 21, 2015 at 18:19
1

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

0

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.

3
  • Please explain, how to do that (see How do I write a good answer?). Apr 24, 2015 at 10:28
  • 1. If you are using centos, you can head over to link to grab the latest rpm and install it. If you get errors about dependencies, I came across an excellent tutorial here: link 2. If you are on Ubuntu, it is simple: sudo apt-get install tmux 3. If you are comfortable compiling packages, then there is the source code on sourceforge: link Apr 27, 2015 at 13:49
  • 1
    Please edit your answer, if you want to add information. Apr 27, 2015 at 19:04
0

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

enter image description here

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.

0

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 bash

I 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
0

you can use the application "screen"

Install screen by running the following command:

apt-get install screen

To verify that screen has been installed, run

screen -v

within 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

0

There are inbuilt shortcuts for this, and easy navigation too.

Ctrl + Alt + T - press once to start the 1st terminal
Ctrl + Shift + T - press 3 times, to get 3 more terminal as Tabs, within the same window of 1st terminal
Alt + 1 or Alt + 2 or Alt + 3 or Alt + 4 - each will these will switch to corresponding tab/terminal.

Hope that helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .