Skip to content

Instantly share code, notes, and snippets.

@spencershepard
Last active April 26, 2025 16:30
Show Gist options
  • Save spencershepard/16886341d33952bd5ba04ab8a91f9466 to your computer and use it in GitHub Desktop.
Save spencershepard/16886341d33952bd5ba04ab8a91f9466 to your computer and use it in GitHub Desktop.
Install zshell and auto-suggestions (Ubuntu)
#!/bin/bash
ZSHRC_FILE="$HOME/.zshrc"
echo "Installing packages..."
apt update && apt install -y zsh zsh-autosuggestions zsh-syntax-highlighting
# Check if the .zshrc file exists
if [[ ! -f "$ZSHRC_FILE" ]]; then
echo "$ZSHRC_FILE not found. Creating..."
touch "$ZSHRC_FILE"
fi
# Search for "zsh-autosuggestions" in the .zshrc file
if grep -q "zsh-autosuggestions" "$ZSHRC_FILE"; then
echo "zsh-autosuggestions is already configured in .zshrc"
else
echo "Plugins not found in $ZSHRC_FILE. Adding..."
echo "source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> "$ZSHRC_FILE"
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> "$ZSHRC_FILE"
fi
echo "Changing default shell to zsh..."
chsh -s /usr/bin/zsh
echo "zsh will be available for $USER after next login"
echo "Run 'source $ZSHRC_FILE' to apply changes immediately"
@spencershepard
Copy link
Author

spencershepard commented Apr 26, 2025

curl https://gist.githubusercontent.com/spencershepard/16886341d33952bd5ba04ab8a91f9466/raw/b7659762f4ee6bebe917835e0ac145f4564fa1b7/install-zsh.sh | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment