tmux

1 minute read

What is tmux?

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

When should we use tmux?

  • Keep workshop clean
  • Easy to restore workshop
  • Remote pairing

How to install tmux?

  • Install tmux using HomeBrew

    brew install tmux
    
  • Download tmux configuration

    Download the .tmux.conf to ~/

How to use tmux?

The shortcut key of tmux has one prefix which is <C-b> in default. In our configuration, we use <C-a> as the prefix

How to manage session?

  • Create session

    tmux new-session -s <session name> 
    
  • Attach session

    tmux attach -t <session name> 
    
  • Switch session

    <prefix> s
    
  • Quit session

    <prefix> d
    
  • Refresh tmux configuration

    <prefix> R
    
  • Install Plugin

    <prefix> I
    

How to manage window and pane?

  • Create window

    <prefix> c
    
  • Switch window

    <prefix> p // next window
    <prefix> [0-9] // the specified window
    
  • Create pane

    <prefix> | // vertical pane
    <prefix> - // horizontal pane
    
  • Switch pane

    <prefix> h // left pane
    <prefix> l // right pane
    <prefix> j // down pane
    <prefix> k // up pane
    
  • Adjust pane size

    <prefix> Shift-h // move left
    <prefix> Shift-l // move right
    <prefix> Shift-j // move down
    <prefix> Shift-k // move up
    

How to search and copy?

<prefix> [ // Enter copy mode
Space      // Begin to select text
/          // Search keyword
Enter      // Copy text and exit copy mode

How to remote pair?

  • SSH+tmux

    tmux-remote-pairing

  • tmate

    tmate-remote-pairing

How to prompt help message?

<prefix> ?

Updated:

Comments