Zellij

Zellij is a new Rust-based terminal multiplexer. It's aimed to replace tmux.

Quick Start

  1. -->Install

    1
    cargo install --locked zellij
  2. By default, zellij will use ~/.config/zellij/config.kdl as its config file. You need to create it first:

    1
    2
    mkdir ~/.config/zellij
    zellij setup --dump-config > ~/.config/zellij/config.kdl

    --> Set config file

    However, since I use "dotfiles", I replace it with my dotfile.

  3. First, create environment variables for convience:

    1
    2
    3
    4
    # In `~/.zshrc`
    # Zellij. Default config dir is $HOME/.config/zellij
    export ZELLIJ_CONFIG_DIR="$DOT_FILE_HOME/zellij"
    export ZELLIJ_CONFIG_FILE="$ZELLIJ_CONFIG_DIR/config.kdl"
  4. Next, replace ~/.config/zellij/config.kdl with my dotfile.

    1
    2
    rm ~/.config/zellij/config.kdl
    ln -s $ZELLIJ_CONFIG_FILE ~/.config/zellij/

Config

Zellij Config Options

pane_frames false

Theme

  1. Choose one theme from -> Zellij Theme Gallery.

  2. Go to zellij-utils/assets/themes. Choose the theme file.

  3. In the configuration file of zellij:

    1. Under the "themes" section, secify your theme.

    2. Paste the code of the theme you like.

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      themes {
      gruvbox-light {
      fg 124 111 100
      bg 251 82 75
      black 40 40 40
      red 205 75 69
      green 152 151 26
      yellow 215 153 33
      blue 69 133 136
      magenta 177 98 134
      cyan 104 157 106
      white 213 196 161
      orange 214 93 14
      }
      //other themes
      }

      //...

      // Choose the theme that is specified in the themes section.
      // Default: default
      //
      theme "gruvbox-light"

Commands

  • Start a new named session:

    1
    zellij --session name
  • List existing sessions:

1
zellij list-sessions

  • Attach to the most recently used session:

    1
    zellij attach
  • Attach to the session with the given name:

    1
    zellij attach <session-name>
  • Attach to given seesion:

    1
    zellij attach <session-name>
  • Detach from the current session (inside a zellij session):

    Ctrl + O, D  

Usage

Normally, we login to a server, start Zellij on it. Then create a Zellij session, run commands it. Then we can close the ssh session to do other things. The command will not be stopped, it'll run in the Zellij session.

We can attach the Zellij session to see it.

  1. Start a new named session, say exp:

1
zellij --session exp

  1. Run some commands in it. Such as

    1
    xvfb-run -s "-screen 0 1400x900x24" python data/generation_script.py --rollouts 1000 --rootdir datasets/carracing --threads 8
  2. This command may take 10 hours. We can detatch current Zellij session, close our ssh session and do other things.

    1
    Ctrl + O, D
  3. We can view all active Zellij sessions

    1
    zellij list-sessions
  4. We can re-attach this session

    1
    zellij attach exp