DEV Community

Cover image for Why Oh My ZSH is so cool?
Camilo Martinez
Camilo Martinez

Posted on • Updated on

Why Oh My ZSH is so cool?

There is a before and after listening to these letters together: ZSH. You may wonder: Why did not I hear about this before? D'oh!

ZSH (Z Shell) it's a real evolution, modernize terminal things with simple solutions. But the thing getting better when you discover Oh My ZSH! a framework for ZSH that boost your productivity and improve your workflow.

cool bro

So, why?

  • No more cd (change directory) command. Just use:
Command Result
folder/ write the folder name with / at the end
.. go back one folder (parent dir)
... go back two folders (parent from parent dir)
...... go back five folders
/ go to root
~ go to home
- jump to previous path
  • Recursive path expansion. /u/lo/b expands to /user/local/bin

  • Spelling correction and approximate completion, automatic correct when having minor mistake typing a directory name

  • take the 3 in 1 command who create a directory and automatically change the path to it

Command Result
take <url_file> Download gzip file (.gz, .bz2, .xz) and uncompress
take <git_repo> Clone git repo from url (http, ssh)
take <folder> Create a new folder
  • zsh_stats will give you a list of the top 20 commands and how many times they've been run

  • Tab completion is another great feature. For example, typing ls - and pressing TAB will list all of the command's options, along with a helpful description of what they do

  • Alias commands. List all with alias or filter it with grep for example alias | grep git

  • Globbing

Command Result
ls *.txt list all txt files in the current directory
ls **/*.txt list all txt files including subdirectories
ls **/(READ)*.* find for files that start with the word READ
ls **/*(READ).* find for files that end with the word READ
ls **/*(READ)*.* find for files that have the word READ anywhere
ls **/*(.) search for files only
ls **/*(/) search for folders only
  • Expanding File Names and Directories
Command Result
touch name-{1..4}.txt create files name-1.txt, name-2.txt, name-3.txt, name-4.txt
touch name.{css,js,test.js} create files with different extension name.css, name.js, name.test.js
cp folder/name.js{,.bak} create a copy of the file ending .bak
diff folder/{new,old}/name.js view differences between two files
mkdir -p {source,build,man,help{/pages,/yelp,/images}} create a complete folder structure
wget{1,2}/pic{001,002}.jpg download multiple files
  • Expand environment variables $ENV followed by TAB

  • Expand kill command followed by TAB

  • History substring search writing a command and pressing the up arrow cycles through previous usages

  • Autocomplete, jump between options with tab, and press return for selection. Works with directories, files, and commands

  • Run history command with ! followed by the number in history, like !137

  • Entering !! will bring up the last command. This is handy if a command fails because it needs admin rights. In this case you can type sudo !!


There are a lot of plugins to use. It's recommended to explore the options and use what is good for your needs.

My recommendations are:

  • sudo to easily prefix your current or previous commands with sudo by pressing esc twice
  • command-not-found to provide suggested packages to be installed if a command cannot be found
  • extract that extracts the archive file you pass it, and it supports a wide variety of archive filetypes
  • git provides many aliases and a few useful functions
  • history-substring-search a clean-room implementation of the Fish shell's history search feature, where you can type in any part of any command from history and then press chosen keys, such as the UP and DOWN arrows, to cycle through matches
  • web-search adds aliases for searching with Google, Wiki, Bing, YouTube and other popular services
  • z command that tracks your most visited directories and allows you to access them with very few keystrokes

I've another extra from plugins from external repositories to add more functionalities:


There are also a lot of themes, but my favorite is Powerlevel10k because is easy to set up and use



Incredible and complete aliases for Git

Git Status Prompt can contain the following bits:

segment meaning
master current branch
#v1 HEAD is tagged with v1; not shown when on a branch
@5fc6fca4 current commit; not shown when on a branch or tag
⇣1 local branch is behind the remote by 1 commit
⇡2 local branch is ahead of the remote by 2 commits
⇠3 local branch is behind the push remote by 3 commits
⇢4 local branch is ahead of the push remote by 4 commits
*5 there are 5 stashes
merge merge is in progress (could be some other action)
~6 there are 6 merge conflicts
+7 there are 7 staged changes
!8 there are 8 unstaged changes
?9 there are 9 untracked files


Edit long command

ctrl+x+e open the command on an editor to easy edit, once save and close the editor it will be updated on the terminal

You can set your favorite editor, for example run export EDITOR="code -w" to use VSCode

Park a command

ctrl+q "parks" the command you're currently typing and takes you back to the prompt, letting you start over and type another command. Once you run that other command, the original command is un-parked and refills the command line so you can continue.

This is good for if you, say, forgot to do a command before a command.

Reveal alias

ctrl+x a will transform the alias to the real command

Path history

ZSH keeps the history of directories you visited so you can quickly switch to any of them.

To see the list, type dirs -v. Switch to any directory in this list by typing ~# where # is the number of the directory in the list.


You can personalize actions (before and after a command) with ZSH Hooks

That's All Folks!
Happy Coding 🖖



Top comments (14)

tiagobnobrega profile image
Tiago Nobrega

PowerLevel10k is nice... but have you tried starship?

equiman profile image
Camilo Martinez

Nop I didn't, should I?

It seems to be faster. What other cool things have?
Do they have an easy step configuration like p10k?

crisz profile image

I just installed it and... how the hell I was able to install a so much pervasive tool without sudo?
By the way it's super cool!

equiman profile image
Camilo Martinez

It's because is a framework that runs over ZSH (just adding utilities).

krlz profile image

thanks for sharing

icolomina profile image
Nacho Colomina Torregrosa

Thanks for sharing, let's give it a try :)

360macky profile image
Marcelo Arias

I love Oh My Zsh! 😁

johnsmoth21 profile image

I love oh-my-zsh I have been using it for years.
Have you tried oh-my-fish?

equiman profile image
Camilo Martinez • Edited

No, I've listened some times on podcasts about it. But I haven't tried it.

Should I?

moopet profile image
Ben Sinclair

The majority of things people promote about zsh are things that are also available in any other shell. I think the joy of finding out about a new feature eclipses everything else, and there are so many posts talking about it that it feels like it really must be unique to zsh.

I'm pretty sure the reason people go on about zsh being better than bash is because so many developers were stuck using MacOS for so long, where Apple only used bash v3 because they didn't want to include anything with GPL3 in their OS. Modern versions of bash (i.e. anything after version 4 which came out about 8 or 9 years ago) have the double-star globbing, for example. Developers were deliberately kept in the dark about this by Apple, and so when they switched to zsh (which uses the MIT license) people started comparing it to the massively out-of-date version of bash. Anyone using any other OS with bash (WSL, Windows with git-bash, Linux, *BSD...) was probably up-to-date and didn't see what the fuss was.

zsh does have some nice things, but it also has some frustrations not present in other shells. I find the default command recall to be very annoying, for instance.

Most of the "plugins" are things that work outside omz, but which have been packaged as a plugin, that's all. You don't need to restrict yourself to using omz, and you don't need to install an entire framework to get something you could install on its own.

For instance, Powerlevel10k is its own thing. It doesn't need to be managed by omz - rather than use plugins for omz, use it directly, or use something else - like starship perhaps.

I don't want to say, "don't use it", but I do want to say that most of the zsh workflow is down to personal preference, and most of the omz stuff is just bloat.

equiman profile image
Camilo Martinez • Edited

Totally agree. For me, the good thing about the ZSH, Fish, and the other new shell is that gives us an alternative to choose from. Even bash starts to improve because of that including some features from other shells, but I still missing the hooks feature that it's already included on ZSH.

It's totally true about mac users, a little know that you can install manually. In my case, I use the new bash in the default terminal and zsh on iTerm.

As you mention we don't need the OMZ or P10K, like we don't need frameworks for development, but we use them because his "time-saving" and because are easy to use and config.

The good thing about all of this is that we have alternatives to choose and we can decide what shell or framework to use.

By the way, I'm going to take a look at the starship alternative.

andreas_herz profile image
Andreas Herz

You should try out Warp terminal. It has really nice features like AI completion & command search 👌🏽

Thread Thread
equiman profile image
Camilo Martinez • Edited

Wrap terminal looks amazing, sadly I'm actually working with Windows and it is not available yet.

adriens profile image

testing is adopting !

Some comments have been hidden by the post's author - find out more