Tmux is a terminal multiplexer that allows multiple terminal sessions to be accessed simultaneously in a single window.

It is possible to put the sessions in background and re-attach them later. In case of the connection drops, the session remains running in background.

Shortcuts

  • ctrl+b %
    • divides the window vertically;
  • ctrl+b
    • devices the window horizontally;
  • ctrl+b left|right|up|down
    • navigates between panes;
  • ctrl+b c
    • creates a new window;
  • ctrl+b 0
    • selects window 0;
  • ctrl+b ,
    • renames the current window;
  • ctrl+b d
    • detaches the session (leave the session running in background);

Sections

  • tmux ls
    • list active sessions;
  • tmux attach -t 0
    • attaches to session 0;
  • tmus rename-session -t 0 new_name
    • renames session 0 to new_name;
  • tmux new -s session_name
    • creates a new session giving a name to it;
  • tmux kill-session -t 0
    • closes the session 0

Resizing panels

  • ctrl+b :
    • :resize-pane -U 5
    • :resize-pane -D 10
    • :resize-pane -L 15
    • :resize-pane -L 20

To enable the mouse to select and resize panels create the file ~/.tmux.conf and add set -g mouse on.


The full link of the commands is available at [Link].

An alternative tool for Tmux is called Screen:

sudo apt install screen
screen