Working with ‘tmux’

Working with ‚tmux‘ enables a number of terminals to be created, accessed, and controlled from a single screen in Unix. The screen can be splitted vertically and horizontally (called panes). Like ’screen‘ tmux can handle different sessions.

Get a list of running, named tmux sessions
~$: tmux ls

Create a new named tmux session
~$: tmux new-session -s [sessionname]

Reopen an existing tmux session
~$: tmux a -t [sessionname]

Shortcuts within a session:
Managing windows
Ctrl+b c: Open/Create a new window within a tmux session
Ctrl+b ,: Rename the current window
Ctrl+b n: Switch to next windows
Ctrl+b p: Switch to previous window
Ctrl+b w: List all windows
Ctrl+b 0-9: Switch to window 0-9 of the tmux session

Managing panes
Ctrl+b %: Split window vertically
Ctrl+b „: Split window horizontally
Ctrl+b arrow key: Switch pane
Hold Ctrl+b, don’t release it and hold one of the arrow keys: Resize pane
Ctrl+b [: Start copy mode. Simply quit with q. PgUp/PgDown lets you scroll up/down.
Ctrl+b q: Show pane numbers
Ctrl+b {: Move current pane left
Ctrl+b }: Move current pane right
Ctrl+b &ltspace>: Toggle through different pane layouts
Ctrl+b !: Break pane into its own window

Ctrl+b : setw synchronize-panes on/off: Synchronize commands to all panes

Managing Session
Ctrl+b $: Rename current session
Ctrl+b d: Detach current session
Ctrl+b &: Kill current session

Ctrl+b :: Open command prompt
Ctrl+b x: Exit terminal
Ctrl+b ?: Help

1: Detaching a session will leave it (and all its windows) but let it run in the background
2: Exit a pane/window will close it and it´s commands.

Download my .tmux.conf

External resources:
– http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/
– http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/
– http://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily/

Working with ’screen‘

Working with ’screen‘ lets you run multiple „virtual“ windows in Unix. This becomes very interesting on working with a shell and want to quit the shell connection without killing a running shell command (the command already has to be started in a screen).

Get a list of running, named screen sessions
~$: screen -ls

Create a new named screen session
~$: screen -S [screenname]

Reopen a named screen session, if not available, create it
~$: screen -R [screenname]

Reopen a named screen session
~$: screen -r [screenname]

Reopen a named screen session which is already attached wlsewhere
~$: screen -rx [screenname]

Detach a named screen session
~$: screen -d [screenname]

Kill a named screen session remote
~$: screen -X -S [screenname]

Shortcuts within a session:
Ctrl+a c: Open/Create a new window within a screen session
Ctrl+a a: Switch to the last screen window
Ctrl+a d: Detach the screen session [1]
Ctrl+a k: Kill the screen session [2]
Ctrl+a ESC: Scroll screen up/down with the arrow keys (ESC to quit scroll mode)
Ctrl+a „: Get a window overview of the screen session
Ctrl+a 0-9: Switch to window 0-9 of the screen session

1: Detaching a screen will leave the screen (and all its windows) but let it run in the background
2: Killing a session will leave the screen (and all its windows) and close it.