Tags

, , , ,

tmux is a terminal multiplexer. It allows you to access a tmux terminal using multiple virtual terminals.
tmux takes advantage of a client-server model, which allows you to attach terminals to a tmux session.
This means that you can run several terminals at once concurrently off of a single tmux session without spawning any new actual terminal sessions.
This also means that sudden disconnects from a cloud server running tmux will not kill the processes running inside the tmux session.
tmux also includes a window-pane mentality, which means you can run more than one terminal on a single screen.

...
$ sudo apt-get install tmux
#To begin a new tmux session:
$ tmux
#Here is a list of a few basic tmux commands:
# Ctrl+shift b(then release) " - split pane horizontally.
# Ctrl+shift b(then release) % - split pane vertically.
# Ctrl+shift b(then release) arrow key - switch pane.
# Ctrl+shift d(then release) - close current pane
# Hold Ctrl+b, don't release it and hold one of the arrow keys - resize pane.
# Ctrl+shift b(then release) c - (c)reate a new window.
# Ctrl+shift b(then release) n - move to the (n)ext window.
# Ctrl+shift b(then release) p - move to the (p)revious window.
# Ctrl+shift b(then release) z - return to previous window
...

Recommended .tmux.conf configuration

$ vi ~/.tmux.conf
# Enable mouse support 
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-window-option -g mode-mouse on


# Highlighting Current Window Using Specified Colour
set-window-option -g window-status-current-bg yellow

# Activity Monitoring
setw -g monitor-activity on
set -g visual-activity on

Next re-target the tmux conf file
$ tmux source-file ~/.tmux.conf

$ tmux new -s myname #start new with session name myname 
$ tmux ls
0: 1 windows (created Sun Jun 19 01:12:05 2016) [172x28] (attached)
myname: 1 windows (created Sun Jun 19 01:12:05 2016) [172x28] (attached)
$ tmux attach -t 0 #To re-attach to a session
$ tmux kill-session -t myname #To kill session

References:

lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily
sitepoint.com/tmux-a-simple-start/
digitalocean.com/community/tutorials/how-to-install-and-use-tmux-on-ubuntu-12-10–2

Advertisements