Back to DevOps Series
Zsh (Z Shell) :

Zsh (Z Shell) :

notion image
Zsh = Z Shell
It is a modern, powerful shell built on top of sh/bash ideas, but focused more on interactive comfort.
Think of it like this:
  • bash = Android phone
  • zsh = Android + custom ROM + premium UI
(same power, but smoother and smarter)
macOS uses Zsh as the default shell now.

1. Why is Zsh so popular?

Because it gives you:
  • Auto-suggestions while typing
  • Very smart tab completion
  • Powerful globbing
  • Better command history
  • Easy customization (themes & plugins)
  • Excellent interactive experience
  • Works perfectly with DevOps & development tools
This is why macOS users and power users love zsh.

2. Where is Zsh located?

Usually at:
/bin/zsh
Many scripts or shells start with:
#!/bin/zsh
→ This means “Run this using the Zsh shell.”

3. Zsh Prompt — Why It Looks So Cool

The modern prompt you see:
atul@macbook ~/project ❯
comes from zsh customization.
Zsh can show:
  • Git branch
  • Exit status
  • Icons
  • Colors
  • Path shortcuts
(all without extra scripting)

4. Zsh Configuration File

Zsh reads settings from:
~/.zshrc
This is where you:
  • Set aliases
  • Enable plugins
  • Change themes
  • Customize behavior

5. Your First Zsh Script

Create a file: hello.zsh
#!/bin/zsh
echo "Hello from zsh!"
Run it:
chmod +x hello.zsh
./hello.zsh
Output:
Hello from zsh!

6. When should YOU use Zsh?

  • If you are on macOS
  • If you want best interactive experience
  • If you use Git daily
  • If you like productivity & clean UI
Zsh is not required, but it makes life easier.

7. Zsh vs Bash (Truth)

  • Scripts → Bash
  • Daily terminal work → Zsh
  • Servers → Bash
  • macOS → Zsh

8. Story to Remember Zsh Forever

If sh is the grandfather
and bash is the smart grandson
then zsh is the stylish grandson
same brain as bash, but dressed better, talks smarter, and helps before you ask.
👉 Zsh = Bash + comfort + intelligence
 
 

 

Home work (Must go though these Features) For getting a basic Idea :

9 Zsh Features You Will Actually Use

Only real-life useful features, nothing extra.

1. Auto-suggestions (Big Zsh advantage)

Start typing:
git pu
Zsh suggests:
git push origin main
(Press → to accept)

2. Smart Tab Completion

Type:
cd Do
Press TAB → shows options like:
Documents/ Downloads/

3. Better Command History

  • Searches history as you type
  • Smarter than bash history

4. Aliases

alias gs="git status"
Now just type:
gs

5. Advanced Globbing

ls **/*.js
Lists all .js files recursively
(bash can’t do this easily)