DEV Community

Shawon Saha
Shawon Saha

Posted on

5 1

Setup ZSH for suggestion, auto completion and text highlighting on linux terminal

Install ZSH, Syntax Highlighting and Auto Suggestions

sudo add-apt-repository universe

sudo apt update

sudo apt install zsh zsh-syntax-highlighting zsh-autosuggestions

zsh
Enter fullscreen mode Exit fullscreen mode

Add syntax-highlighting and autosuggestions to your zshrc file

cp ~/.zshrc ~/.zshrcbackup

echo "source $(dpkg -L zsh-autosuggestions | grep 'zsh$')" | tee -a ~/.zshrc

echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" | tee -a ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Source your ~/.zshrc file to apply the changes (if you are in bash or another shell, run the zsh command first)

zsh

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Make zsh the default shell

chsh -s $(which zsh)
Enter fullscreen mode Exit fullscreen mode

Now here is a pitfall

Your command history will get cleaned after closing the terminal. So you need to store your commands somewhere to retrieve later.

Open .zshrc file in text editor (for simplicity i've used xed you can use nano/ vim/ code or any other text editor)

xed ~/.zshrc
Enter fullscreen mode Exit fullscreen mode
  1. Add this following lines to ~/.zshrc file
HISTFILE="$HOME/.zsh_history"
HISTSIZE=500000
SAVEHIST=500000
setopt appendhistory
setopt INC_APPEND_HISTORY  
setopt SHARE_HISTORY
Enter fullscreen mode Exit fullscreen mode

Save the file

source your ~/.zshrc file to apply the changes (Repeat Step 4)

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Now all of your command history will save in ~/.zsh_history file.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more