Skip to content

Shell

On most operating systems instructions can be given via a command line interface (CLI). For this a program like Terminal, Xterm, iTerm2, MobaXterm, Command Prompt or Powershell can be used. These terminals start a shell on the computer and allow the user to enter commands in this shell. There are multiple shells to choose from, each with its own feature set and purpose. This documents provides information on how to install and configure some of these shells.

Zsh with Starship and autosuggest

Zsh is the most preferred shell and the default on macOS. On most Linux systems it is installed or available as a package.

  1. check if /bin/zsh is available and install if not:

    ls /bin/zsh
    # if not found
    whereis zsh
    # if still not found
    locate zsh
    # if really not there
    apt install zsh # or your favourite package manager...
    

    also make sure zsh is in /etc/shells.

  2. create an empty resource file for zsh .zshrc:

    cd ~
    mv .zshrc .zshrc_pre-starship # might give a warning if not there
    touch .zshrc
    
  3. change shell to zsh:

    chsh -s /bin/zsh # or the location of zsh
    
  4. install Starship prompt with the instructions on the website:

    Font installation

    Make sure to install the right font as mentioned in the Prerquisites on the install page!

    Font suggestion

    Preferably install the “Fire Code Nerd Font”. On macOS with iTerm2 you will need to install:

    • Fire Code Bold Nerd Font Complete.otf
    • Fire Code Light Nerd Font Complete.otf
    • Fire Code Medium Nerd Font Complete.otf
    • Fire Code Regular Nerd Font Complete.otf
    • Fire Code Retina Nerd Font Complete.otf

    In iTerm2 goto menu iTerm2PreferencesProfilesTextFont and select Firacode Nerd Font.

    No write permissions /usr/local

    The starship installer default installs the program in /usr/local/. On systems where you do not have permissions to write in /usr/local/ and you cannot use a package manager, do the following:

    cd ~
    mkdir -p local/bin
    curl -fsSL https://starship.rs/install.sh > starship_install.sh
    bash starship_install.sh -b ~/local/bin
    echo 'eval "$($HOME/local/bin/starship init zsh)"' >> .zshrc
    
  5. install zsh-autosuggest extension with the instructions on the website below **Manual (Git Clone):

  6. EXTRA: configure Windows title. Add the following lines to .zshrc:

    function set_win_title(){
        echo -ne "\033]0; $USER@$HOST:$PWD \007"
    }
    precmd_functions+=(set_win_title)
    
  7. check .zshrc_pre-starship, .bashrc and .bash_profile for configurations that need to be copied in the new .zshrc. If Miniconda is already installed do the following:

    ~/miniconda3/bin/conda init zsh
    

Fish

Fish is the newest kid on the block and has some very nice extensions available straight out of the box.

  1. install Fish shell with the instructions on this page:

    • https://fishshell.com
  2. dive into the Tutorial and/or Documentation to learn about Fish and how to configure it! Have fun 😄

Bash with Starship

Bash is the long-time default shell in Linux. It is good but recently lagging a little behind in speed and performance compared to zsh. There is no autosuggest extension for bash!

  1. create an empty resource file for zsh .bashrc:

    cd ~
    mv .bashrc .bashrc_pre-starship # might give a warning if not there
    touch .bashrc
    
  2. change shell to bash:

    chsh -s /bin/bash # or the location of zsh
    
  3. install Starship prompt with the instructions on the website:

    Font installation

    Make sure to install the right font as mentioned in the Prerquisites on the install page!

    Font suggestion

    Preferably install the “Fire Code Nerd Font”. On macOS with iTerm2 you will need to install:

    • Fire Code Bold Nerd Font Complete.otf
    • Fire Code Light Nerd Font Complete.otf
    • Fire Code Medium Nerd Font Complete.otf
    • Fire Code Regular Nerd Font Complete.otf
    • Fire Code Retina Nerd Font Complete.otf

    In iTerm2 goto menu iTerm2PreferencesProfilesTextFont and select Firacode Nerd Font.

    No write permissions /usr/local

    The starship installer default installs the program in /us/local/. On systems where you do not have permissions to write in /usr/local/ and you cannot use a package manager, do the following:

    cd ~
    mkdir -p local/bin
    curl -fsSL https://starship.rs/install.sh > starship_install.sh
    bash starship_install.sh -b ~/local/bin
    echo 'eval "$($HOME/local/bin/starship init bash)"' >> .bashrc
    

Last update: 2021-03-16