My powerful ZSH profile

My powerful ZSH profile

The following content is also available in my GitHub Repo.

NOTE: All this content was created under Linux Ubuntu 24.04 Desktop, but with small adjustments, the following can also be used for Windows and macOS.

Due to my constant Senior Linux SysAdmin work, I migrated some time ago from BASH to ZSH shell with all the following and very beneficial tools included:

  • Oh My Zsh - Oh My Zsh framework for managing the ZSH configuration.
  • Oh My Posh - Put your terminal prompt nice!
  • nerd-fonts - It is required for the Oh My Posh configuration.
  • eza - A nice tool for listing files on the terminal.
  • nvim - A very nice and powerful text editor.
  • tmux - A powerful terminal multiplexer.
  • zsh-autosuggestions - A very common zsh plugin for autosuggestions.
  • zsh-syntax-highlighting - A very common zsh plugin for syntax highlighting.
  • zsh-history-substring-search - A very common zsh plugin for history search.
  • tmux-xpanes - A very powerful complement for the tmux multiplexer.
  • lxd-completion-zsh - lxc commands constantly upgrade, so that this plugin will fix the issue with the tab completion for the rest of the lxc subcommands.

Content

Installation

  1. Install Oh My Zsh and Oh My Posh.

    Oh My Zsh:

    sudo apt install git curl zsh zip unzip -y
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    

    Oh My Posh:

    mkdir ~/bin
    curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/bin
    

    Optional: Only if wanted to install Oh My Zsh and Oh My Posh in the root prompt

    sudo su -
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    mkdir ~/bin
    curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/bin
    exit
    exit
    
  2. Run the following commands to install the plugins.

    NOTE: If using the root prompt too, don’t forget to run the following git clone commands in root.

    Ubuntu Packages:

    sudo apt install eza tmux neovim -y
    

    Oh My Zsh Plugins:

    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
    git clone https://github.com/greymd/tmux-xpanes.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/tmux-xpanes
    git clone https://github.com/endaaman/lxd-completion-zsh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/lxd-completion-zsh
    

    tmux Plugins:

    git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
    git clone https://github.com/tmux-plugins/tmux-sensible ~/.tmux/plugins/tmux-sensible
    git clone https://github.com/tmux-plugins/tmux-yank ~/.tmux/plugins/tmux-yank
    git clone https://github.com/tmux-plugins/tmux-copycat ~/.tmux/plugins/tmux-copycat
    git clone https://github.com/jimeh/tmux-themepack.git ~/.tmux/plugins/tmux-themepack
    

Configuration

  1. Clone and copy the config files and directories from my GitHub repository to use them at ~/ for the $USER to configure the profile, do the same for root if it is also in use.

  2. Download the nerd-fonts package with the following command:

    wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Meslo.zip -O ~/Downloads/nerd-fonts.zip
    
  3. Use the ~/Downloads/nerd-fonts.zip package recently downloaded to install/configure the fonts in the terminal for Oh My Posh prompt.

nerd-fonts Installation

  1. Run the following commands to install the fonts.

    sudo unzip ~/Downloads/nerd-fonts.zip -d /usr/share/fonts/nerd-fonts
    sudo fc-cache -v -f /usr/share/fonts
    
  2. Once the fonts are installed, use the terminal app of your choice and set the font MesloLGM Nerd Font.

  3. Set the ZSH shell as default.

    For non-root:

    chsh -s /bin/zsh $USER
    

    For root: (Optional: Only if was installed Oh My Zsh and Oh My Posh in root.)

    sudo su -
    chsh -s /bin/zsh root
    exit
    
  4. Finally, do a logout and log back in or reboot the machine to see the new shell coming.

At this point, we should be all set and have a powerful ZSH prompt.

I hope all this above helps others! :sunglasses:

2 Likes