dev-notes

Tmux

Setup

  1. Install tmux package manager: link
  2. Create tmux dot file

    vi ~/.config/tmux/tmux.conf
    

    add following code

     # List of plugins
     set -g @plugin 'tmux-plugins/tpm'
     set -g @plugin 'tmux-plugins/tmux-sensible'
    
     run '~/.tmux/plugins/tpm/tpm'
    
  3. Run tmux to load it

    tmux source ~/.config/tmux/tmux.conf
    

Tmux Features

It consist of 3 main parts

> Sessions
    > Windows
       > Panes

How to enter command : enter prefix default = Ctrl+b

  1. Create a window :

     <prefix> c
    
  2. Change between windows :

     <prefix> <window number > or  <prefix> n or <prefix> p
    
  3. Close a window :

     <prefix> &
    
  4. Split a window horizontally :

     <prefix> %
    
  5. Split a window vertically :

     <prefix> "
    
  6. Navigating :

     <prefix> <arrow-keys>
     <prefix> {  }
     <prefix> q <num>
    
  7. Zoom into a pane :

    <prefix> z
    
  8. Turn a pane into a window :

    <prefix> !
    
  9. Close a pane :

    <prefix> x
    

sessions

  1. Create a session :

    tmux
    
  2. Create a session with a name :

    tmux new -s my-session
    

    while still on tmux session :

    <prefix> :new
    
  3. List the active tmux sessions : if outside the session

    tmux ls
    

    if inside the session

    <prefix> s
    

    to show window also

    <prefix> w
    
  4. Attach to a session : when outside tmux recent session

    tmux attach
    

    named-session

    tmux attach -t my-session
    

new prefix c-space