Tmux terminal multiplexer

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.

tmux may be detached from a screen and continue running in the background, then later reattached.

  1. ssh into the remote machine
  2. start tmux by typing tmux into the shell
  3. start the process you want inside the started tmux session
  4. leave/detach the tmux session by typing Ctrl+b and then d


The tmux and GNU screen utilities have many similarities. tmux is considered more modern.

Each session is persistent and will survive accidental disconnection (such as ssh(1) connection timeout) or intentional detaching (with the ‘C-b d’ key strokes). tmux may be reattached using:

tmux attach

Example tmux commands include:

refresh-client -t/dev/ttyp2 

rename-session -tfirst newname 

set-window-option -t:0 monitor-activity on 

new-window ; split-window -d 

bind-key R source-file ~/.tmux.conf \; \ 
	display-message "source-file done"

Or from sh(1):

tmux kill-window -t :1 

tmux new-window \; split-window -d 

tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach