#websocket #tabs #terminal #tab


the websocket utility module for the tab terminal multiplexer

4 releases

new 0.3.4 Sep 16, 2020
0.3.0 Sep 11, 2020
0.2.2 Sep 2, 2020
0.2.0 Aug 31, 2020

#10 in WebSocket

47 downloads per month
Used in 4 crates (3 directly)

MIT license

699 lines

tab, a modern terminal multiplexer designed for overwhelmed software & systems engineers

Tab is a terminal multiplexer written in Rust.


  • Tab is configuration-driven. tab provides persistent tab suggestions which always initialize in the correct working directory. Configuration is defined in simple tab.yml files placed in your workspace and repository roots.
  • Tab is shell-oriented, and minimialistic. Tabs are listed, selected, and closed with a single command, tab. Tab has one disconnect escape sequence, ctrl-W. Tab provides tab-unique command history.
  • Tab provides rich autocomplete. Your library of tabs are completed when switching to a new tab with tab <TAB> . Your running tabs are completed when closing a tab with tab -w <TAB>.
  • Tab is state-agnostic. You can invoke tab to do anything, from anywhere. If a tab isn't running, it's started. If a tab is running, it's reconnected (and possibly shared with another client). If you have a tab selected, and you close it with tab -w mytab, your session is disconnected.
  • Tab is low-latency, and efficient. It has a round-trip latency (stdin to stdout) of ~5ms. The tab daemon uses 0.2% when idle, 1-2% CPU during normal usage, and 5% when a tab is throwing extreme amounts of stdout.


Quick installation & usage instructions:

$ cargo install --git https://github.com/austinjones/tab-rs.git
$ tab foo/     > to open a tab.
$ tab bar/     > to switch to another tab.  
                works within an active session!
$ echo $TAB   > to view the active tab.  
                put this in your promptline, 
                or get https://starship.rs/
$ tab -w foo  > to close a tab.
$ tab -l      > to view the tabs
$ ctrl-W      > to disconnect the session

Tab adds trailing slashes to tab names. This makes autocomplete between foo/ and it's children, foo/bar/ work nicely. You can type tab foo and tab will add the slashes for you.


Tab supports persistent tab.yml configurations. There are two types of configurations:

  • Workspace configurations, which are active within any subdirectory, and link to repositories.
  • Repository configurations, which define tab endpoints. Your typical tab interaction would be switching to one of these repositories via tab myproj/

A full set of example files are available in the examples directory, but here are some starters:


  - repo: my-project/
  - tab: workspace-tab
    doc: "this is a top-level workspace tab"

repo: proj
doc: "my project"

  - tab: run
    dir: src/
    doc: "runs the project server"

With these configurations, tab -l provides the following:

$ tab -l
Available tabs:
    proj/             (my project)
    proj/run/         (runs the project server)
    workspace-tab/    (this is a top-level workspace tab)

Shell Configuration

Tab works best when you configure your terminal with autocomplete, and a statusbar.


The best way to configure the command prompt is to use starship.

In ~/.config/starship.toml, add:

variable = "TAB"
prefix = "tab "
style = "bold green"


tab supports dynamic autocompletion and a custom statusbar in bash.

  1. Install the the autocompletion script:
mkdir -p ~/.tab && tab --completion bash > ~/.tab/_tab.bash
  1. Source the completion script from ~/.bashrc
source ~/.tab/_tab.bash
  1. If you want to add a custom statusline, add to ~/.bashrc
PS1="tab ${TAB:-/} $ "


tab supports dynamic autocompletion and a custom statusbar in fish.

  1. Install the autocompletion script to your fish completions directory.
mkdir -p ~/.config/fish/completions && tab --completion fish > ~/.config/fish/completions/tab.fish
  1. If you want to use a custom command prompt, you can add to ~/.config/fish/config.fish
function fish_prompt
  if test -n "$TAB"
    set_color $fish_color_cwd
    printf 'tab %s' "$TAB" 
    set_color normal
    printf ' in '
    set_color $fish_color_cwd
    printf '%s' (basename $PWD)
    set_color normal
    echo " \$ "
    set_color $fish_color_cwd
    printf '%s' (basename $PWD)
    set_color normal
    echo " \$ "


tab supports dynamic autocompletion and a custom statusbar in zsh.

  1. Install OhMyZsh, and copy the TODO LINK completions/zsh/_tab script to ${ZSH_CUSTOM}/plugins/tab/_tab.
mkdir -p "${ZSH_CUSTOM}/plugins/tab/" && tab --completion > "${ZSH_CUSTOM}/plugins/tab/_tab"
  1. Add tab to your plugins list in ~/.zshrc:
# load the `tab` autocompletions
plugins=(git tab)
autoload -U compinit && compinit

source $ZSH/oh-my-zsh.sh
  1. If you want to use a custom prompt, add to ~/.zshrc
# add the selected tab to the prompt
setopt prompt_subst
if (($+TAB)); then
  PROMPT="%{$fg[green]%}tab ${TAB}%{$reset_color%} $PROMPT"


Tab can execute commands in a terminal, so I take security seriously. This is how I protect your machine in tab:

The tab daemon requires the following to accept any websocket connection:

  • The request must include a 128 byte auth token, stored in the file: ~/.tab/daemon-pid.yml. On unix operating systems, the file is assigned the permissions 600.
  • The Origin header must not be present in the request. This prevents any connection from a browser.
  • The daemon binds to on a random port. This should prevent any attempted connections from the local network.


~197K SLoC