Modern shell environment setup starting with zsh + starship#

Don’t settle for “just using bash” with your newly acquired Linux. Introducing zsh and the high-speed, multifunctional prompt starship, we will set up the minimum necessary settings at once and build a modern shell environment.

Introduction#

Cloud VM , WSL, Raspberry Pi–no matter what Linux you get, bash is the standard at first. Of course, you can work with it as is, but zsh has excellent extensibility and has the potential to become mainstream in the future, such as being adopted as the default login shell of MacOS. And when combined with starship, you can display rich prompts at a fraction of the cost and get a consistent development experience no matter the language stack.

In this article, the goal is to set up a usable zsh environment in about 30 minutes.

  • Introduction of zsh and change of login shell

  • Required & Popular Plugins/Configurations (.zshrc)

  • starship overview and installation

  • Starship customization points you should know at least

I will summarize. Commands that work with copy and paste are mainly written, so please use this instead of a work log.

Prerequisites#

  • Linux (Debian/Ubuntu is used as an example, but Fedora/Arch can also be used)

  • sudo 権限を持つユーザーでログイン済み

  • network connection

Tip: If your existing .bashrc has its own alias, port it to zsh at the end. Don’t forget to make a backup.

Step 0 – Modernize your system#

sudo apt update && sudo apt upgrade -y   # Debian/Ubuntu
# sudo dnf update -y                     # Fedora
# sudo pacman -Syu                       # Arch

Step 1 ─ Install zsh and set it as the login shell#

  1. install

    sudo apt install -y zsh     # または dnf install zsh / pacman -S zsh
    
  2. Switch standard shell

    chsh -s "$(command -v zsh)"
    

    You will need to log in again for the changes to take effect. For SSH sessions, exit → reconnect is OK.

  3. Skip the first-time startup wizard When you start zsh for the first time, a configuration wizard will run, but for now, select (q) quit to skip it.

Step 2 ─ zsh configuration file .zshrc#

  1. Create ~/.zshrc.

    touch ~/.zshrc   # 空の設定ファイルを作成
    
  2. Porting mainly alias/function/export from .bashrc.

    # --- alias
    alias ll='ls -alF'
    alias la='ls -A'
    alias l='ls -CF'
    

Step 3 ─ Introduce starship#

starship is a fast prompt made in Rust. Automatically displays the “information you want right now” such as git branch, language version, exit code, etc.

  1. install

    curl -sS https://starship.rs/install.sh | sh  -s -- -y
    

    It is lightweight because it runs as a standalone binary without the Rust toolchain.

  2. Install Nerd Font

    Requires unzip fontconfig.

    sudo apt install -y unzip fontconfig
    

    Create a font folder and download Nerd Font.

    mkdir -p ~/.local/share/fonts
    cd ~/.local/share/fonts
    curl -LO https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip
    unzip FiraCode.zip
    rm FiraCode.zip
    

    Update font cache.

    fc-cache -fv
    

    Verify the font by viewing it directly from the terminal.

    echo -e "\ufb00 \ufb13 \ue0b0 \uf09b"
    

    If an icon such as ff or ﬓ is displayed, it is successful. If all ? are displayed, the fonts are not installed correctly.

  3. Create configuration file

    Create an empty configuration file for starship’s initial file.

    mkdir -p ~/.config && touch ~/.config/starship.toml
    

    Write the following in starship.toml: Check here for the latest

    # Get editor completions based on the config schema
    "$schema" = 'https://starship.rs/config-schema.json'
    
    # Inserts a blank line between shell prompts
    add_newline = true
    
    # Replace the '❯' symbol in the prompt with '➜'
    [character] # The name of the module we are configuring is 'character'
    success_symbol = '[➜](bold green)' # The 'success_symbol' segment is being set to '➜' with the color 'bold green'
    
    # Disable the package module, hiding it from the prompt completely
    [package]
    disabled = true"
    
  4. Built into shell

    Add eval "$(starship init zsh)" to the end of .zshrc.

    # --- starship
    eval "$(starship init zsh)"
    

    Restart zsh to take effect.

    exec zsh   # または source ~/.zshrc
    

summary#

Now you can use a modern shell environment using zsh + starship. In the future, we will discuss adding plugins as needed.

Reference link

Article information

Post date:

2025-05-03

author:

Mr. Takagi