Created
August 29, 2012 19:12
-
-
Save ivanacostarubio/3517380 to your computer and use it in GitHub Desktop.
TMUX-Cheat-Sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TMUX: | |
| http://www.openbsd.org/cgi-bin/man.cgi?query=tmux&sektion=1#end | |
| http://www.youtube.com/watch?feature=player_embedded&v=4ErEBkj_3PY#t=888s | |
| http://www.dayid.org/os/notes/tm.html | |
| to load source file: | |
| tmux source-file <path> | |
| You can add something like this to the key bindings to your .tmux.conf file: | |
| bind q send-keys "/home/jackhab/bin/tmux-new-session.sh" \; send-keys "Enter" | |
| And in tmux-new-session.sh you can have: | |
| #! /usr/bin/env bash | |
| tmux new-session "monitor1" | |
| tmux split-window -v "monitor2" | |
| tmux select-pane -U | |
| tmux split-window -v -h -p 60 "monitor3" | |
| ... | |
| exit | |
| Create new session sees and call the window task1 | |
| tmux new-session -s sess -d -n task1 | |
| the -d in the last command puts it in the background | |
| Attach to a session: | |
| tmux a -t mysess | |
| List sessions: | |
| tmux list-session 2>&1 | |
| Ctrl-b l (Move to the previously selected window) | |
| Ctrl-b w (List all windows / window numbers) | |
| Ctrl-b <window number> (Move to the specified window number, the default bindings are from 0 – 9) | |
| Ctrl-b q (Show pane numbers, when the numbers show up type the key to goto that pane) | |
| tmux new-session -s consoles -n amazona "cd ruby/amazona ; rails s" \; split-window "cd ruby/amazona; rails c" \; split-window "mongod" \; split-window -h "redis-server /usr/local/etc/redis.conf" | |
| Managing tmux sessions: | |
| $ tmux # start tmux server | |
| $ tmux at # attach running sessions to a terminal | |
| $ tmux ls # list running tmux sessions | |
| Sharing sessions between terminals: | |
| $ tmux new -s session_name # make new named session | |
| $ tmux at -t session_name # attach to exist session (allowing shared sessions) | |
| Commands (used within a running tmux session): | |
| NOTE: All commands need to be prefixed with the action key. | |
| By default, this is CTRL-b | |
| c - create new window | |
| n/l - next/last window | |
| & - kill current window | |
| % - split window, adding a vertical pane to the right | |
| - horizontal split is not bound to a key | |
| ←/→ - move focus to left/right pane | |
| ↑/↓ - move focus to upper/lower pane | |
| ! - Break current pane into new window | |
| x - Kill the current pane. | |
| d - detach the current client | |
| [ - enter copy mode (then use emacs select/yank keys) | |
| * press CTRL-SPACE or CTRL-@ to start selecting text | |
| * move cursor to end of desired text | |
| * press ALT-w to copy selected text | |
| ] - paste copied text | |
| ? - show tmux key bindings | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my tmux.conf, I hope you find something nice in it. =)
General
set -g base-index 1
set -g prefix C-a
set -s escape-time 0
set -g set-titles on
set -g set-titles-string '#H:#S.#I.#P #w #T'
set -g default-terminal "screen-256color"
Bindings
unbind C-b
unbind %
bind r source-file /home/dev/.tmux.conf; display "Reloaded!"
bind \ split-window -h
bind - split-window -v
bind C-a send-prefix
bind k select-pane -U
bind j select-pane -D
bind h select-pane -L
bind l select-pane -R
Panel Resize
bind K resize-pane -U 5
bind J resize-pane -D 5
bind H resize-pane -L 5
bind L resize-pane -R 5
Utilities
bind P pipe-pane -o "cat >> ~/logs/#W.log"; display "Logging started: ~/logs/#W.log"
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run "tmux set-buffer -- "$(xclip -o -sel clipboard)"; tmux paste-buffer"
Status bar
set -g status-utf8 on
set -g status-bg cyan
set -g status-fg white
set -g status-interval 60
set -g status-left-length 40
set -g status-left '[#S #I-#P]'
set -g status-left-bg black
set -g status-right-bg black
set -g status-right '| #h | %Y-%m-%d %H:%M #[default]'
Mouse
setw -g mouse-select-pane on
setw -g mouse-select-window on
window
setw -g window-status-current-format ' #[bg=colour136]#[fg=colour255,bold]#I:#W '
setw -g window-status-current-attr bright
setw -g window-status-attr dim
setw -g mode-mouse on
set -g visual-activity on
setw -g monitor-activity on
setw -g mode-keys vi
Pane
setw -g pane-active-border-fg red
setw -g pane-active-border-bg black
setw -g pane-border-fg white
setw -g pane-border-bg black
setw -g pane-base-index 1