Zellij
Zellij is a new Rust-based terminal multiplexer. It's aimed to replace tmux.
Quick Start
-->Install
1
cargo install --locked zellij
By default, zellij will use
~/.config/zellij/config.kdl
as its config file. You need to create it first:1
2mkdir ~/.config/zellij
zellij setup --dump-config > ~/.config/zellij/config.kdl--> Set config file
However, since I use "dotfiles", I replace it with my dotfile.
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"Next, replace
~/.config/zellij/config.kdl
with my dotfile.1
2rm ~/.config/zellij/config.kdl
ln -s $ZELLIJ_CONFIG_FILE ~/.config/zellij/
Config
Zellij Config Options
pane_frames false
Theme
Choose one theme from -> Zellij Theme Gallery.
Go to zellij-utils/assets/themes. Choose the theme file.
In the configuration file of zellij:
Under the "themes" section, secify your theme.
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
23themes {
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.
- Start a new named session, say
exp
:
1
zellij --session exp
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
This command may take 10 hours. We can detatch current Zellij session, close our ssh session and do other things.
1
Ctrl + O, D
We can view all active Zellij sessions
1
zellij list-sessions
We can re-attach this session
1
zellij attach exp