cheat-sheets

Oh My Zsh

Oh My Zsh (OMZ) is a framework of Zsh plugins, themes and library files. You can use it on its own through its installer, or load only the parts you want through a plugin manager such as antidote. For the underlying shell see Zsh.

Project: Oh My Zsh Documentation: Oh My Zsh wiki

The omz commands were read from the omz function in lib/cli.zsh of a current checkout. Plugin aliases were read from each plugin’s README. The standalone installer was not run ((unverified)).

Install and Update #

COMMANDDESCRIPTION
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"Standalone install into ~/.oh-my-zsh ((unverified); read the script first, it replaces ~/.zshrc and keeps a backup)
omz updateUpdate Oh My Zsh
omz versionShow the version
omz changelogPrint the changelog
omz reloadReload the current zsh session
omz helpList the commands
omz pr test / omz pr cleanTry a pull request / delete the pull request branches
omz shellsaverLaunch a Shellsaver (an aquarium by default); omz shop opens the shop

If you load OMZ through antidote there is no ~/.oh-my-zsh and no omz update: update with antidote update instead.

Plugins #

COMMANDDESCRIPTION
omz plugin listList plugins
omz plugin list --enabledList only the enabled plugins
omz plugin info NAMEShow a plugin’s information
omz plugin enable NAMEAdd a plugin to plugins=(...) in ~/.zshrc
omz plugin disable NAMERemove it
omz plugin load NAMELoad a plugin into the current shell only

In a standalone install, plugins live in $ZSH/plugins and your own in $ZSH_CUSTOM/plugins. Enable them in ~/.zshrc before source $ZSH/oh-my-zsh.sh:

zsh
plugins=(git sudo extract history)

Themes #

COMMANDDESCRIPTION
omz theme listList themes
omz theme use NAMELoad a theme in this shell only
omz theme set NAMEWrite ZSH_THEME into ~/.zshrc

The default theme is robbyrussell. For a faster, richer prompt see Powerlevel10k, which replaces ZSH_THEME (set ZSH_THEME="" or powerlevel10k/powerlevel10k as its docs describe).

Useful Plugins #

PLUGINWHAT IT GIVES YOU
gitDozens of aliases: gst (status), ga / gaa (add), gcmsg (commit message), gcam (commit all), gco / gcb (checkout / new branch), gsw (switch), gl / gp (pull / push), gpf (force with lease), gfa (fetch all, prune), glog (graph log), gstp (stash pop), gwip (wip commit)
sudoPress Esc twice to prefix the current (or previous) command with sudo
extractextract FILE unpacks most archive types
historyAliases h, hl (less), hs (grep), hsi (case-insensitive grep); see Shell History
history-substring-searchUp / down arrows search history by what you have typed
per-directory-historyHistory per directory with a global toggle
zJump to frequently used directories
fzfFuzzy finder key bindings and completion (needs fzf installed)
command-not-foundSuggest the package that provides a missing command
systemd, ubuntu, ansibleAliases and completions for those tools

Check a plugin’s README (omz plugin info NAME or its folder) before enabling it: several wrap commands you may not have installed.

Useful Settings #

Set in ~/.zshrc before source $ZSH/oh-my-zsh.sh:

VARIABLEEFFECT
ZSH_THEMETheme name
plugins=(...)Enabled plugins
ZSH_CUSTOMFolder for your own plugins and themes
DISABLE_AUTO_UPDATE, DISABLE_UPDATE_PROMPTControl the update behaviour (commented examples are in the template zshrc)

Troubleshooting #

SYMPTOMFIX
omz: command not foundOMZ is not loaded as the framework (e.g. loaded through antidote use-omz); use your plugin manager instead
Plugin alias does nothingThe plugin is not in plugins=(...), or is listed after source $ZSH/oh-my-zsh.sh
Slow startRemove plugins you do not use, and see Powerlevel10k instant prompt
Theme icons show as boxesInstall a Nerd Font and select it in your terminal

See Also #

Search all sheets

Tip: / or Ctrl/Cmd+K to open, Esc to close.