Aug 25, 2015

Tmux quick start guide

Tmux is a handy terminal manager that allows you to switch between terminal sessions easily. Without losing history or windows upon ssh disconnects or similar. It is like screen, just better. (First of all because of using client-server based technology... )

Here is my minimal keyboard shortcuts guide that allows you to start using Tmux in a blink of an eye. Endless advanced commands and hotkey combinations you could always find by entering "man tmux" in a terminal.

Tmux is installed quite easily in most of common linux based systems. Just type:
$ sudo apt-get install tmux
$ sudo yum install tmux

This allows you to start using by starting it with
$ tmux a || tmux new
This command first tries to attach to existing running tmux instance and creates new in case it is not found.

Ctrl+b d - Will allow you to disconnect at any time. (This is also a way it is happening when you loose ssh session. How to connect - look earlier)

Each session can have many windows:
Ctrl+b c - Create a new window.
Ctrl+b 0...9 - switch to window #;
Ctrl+b p - switch to previous window;
Ctrl+b n - switch to next window;
Ctrl+b l - switch to next active window (to the one you have switched from to this window);
Ctrl+b & - close this window (Or just type exit in terminal.

One terminal can have multiple windows:
Ctrl+b % - splits current panel in part, vertically;
Ctrl+b " - splits current horizontally;
Ctrl+b →←↑↓ - switch between panels;
Ctrl+b x - close current panel (you could also type exit in a terminal window).

Minus is a scrolling behavior:
Ctrl+b PgUp - enters "copy mode", afterwards:
    PgUp, PgDown - scrolling;
    q - exit copy mode.

Good more complex gist of hotkeys also here:

1 comment: