When we develop in Ubuntu or linux environment, we need many terminals. Gnome terminal only support tab, so we can't see the progress or results in each terminals at same time. tmux is a terminal multiplexer. It can show multi terminals in one terminal screen.

There are many examples, you can see here.

Installation

Requirements

$ sudo apt install libevent-dev libcurses-ocaml-dev

Download latest version tmux at https://github.com/tmux/tmux/wiki

$ tar zxf tmux-2.7.tar.gz 
$ cd tmux-2.7
$ ./configure
$ make
$ sudo make install

If you have error, install the requirement package.

Install tmux plugin manager

$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

create ~/.tmux.conf, and save it.

$ vi ~/.tmux.conf

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'

set -g mouse on
set -g destroy-unattached on
setw -g monitor-activity on
set -g visual-activity on
set -g default-terminal "screen-256color"
set -g history-limit 30000

set -g base-index 1
set -g pane-base-index 1

# Pane splitting.
bind \ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"

run '~/.tmux/plugins/tpm/tpm'

Execute

$ tmux

Register tmux in gnome-terminal

Edit profile in gnome-terminal, click command tab. Check these options,

  • Run command as a login shell
  • Run a custom command instead of my shell
    Custom command: tmux -u

Save. Restart gnome-terminal