tmux

    Tmux is an alternative to screen.

    Shortcuts

    Use ctrl+b, then:

    :new<CR>  new session
    s  list sessions
    $  name session
    
    c  create window
    w  list windows
    n  next window
    p  previous window
    f  find window
    ,  name window
    &  kill window
    
    {  swap current pane with previous pane
    
    %  is vertical split
    "  is horizontal
    
    [space bar] to reorder the panes
    
    Up-arrow scroll up
    Down-arrow scroll down
    
    z  full screen, useful to copy when you have split windows
    
    <  menu to swap, kill, rename, new after/before
    

    Note: to show the associated command with: :list-keys

    Tmux only copy-paste

    requires: setw -g mode-keys vi, else in my experience I was not able to paste

    • ctrl + b, then [ you're in copy mode (by scrolling).
    • Use space bar from your pointer to select.
    • Press enter to save into buffer tmux's buffer
    • Paste from latest entry into tmux's buffer ctrl + b, then ]

    See also related commands:

    • list buffers: :list-buffers
    • paste: :choose-buffers, then select the string to paste

    source

    System/host copy-paste

    Similar to Tmux copy-paste, but use y instead of enter to copy into system's buffer. Paste with shift + insert.

    In order to copy into system's buffer, you need to bind a key to a command such as xclip as below.

    # (optional) if you want `v` like vim to select instead of `space bar`
    bind-key -T copy-mode-vi v send-keys -X begin-selection
    # paste within xclip (system buffer) by using `y`
    bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'
    

    requires: xclip installed

    Resize pane

    Example to resize 2 times Up:

    :resize-pane -U 2
    

    Note: There also -L for left, -R, -D

    Close current command (e.g., freeze ssh)

    :respawn-pane -k
    

    source

    Join windows

    :join-pane -t <target-window-number>
    

    Notes:

    • use w to list windows
    • use -t for target or -s for source

    Move pane to a new window

    :break-pane -dP
    

    source