logo

zsh

Last Updated: 2023-12-06

https://github.com/zsh-users/zsh

zsh vs bash

Zsh is an extended Bourne shell, just like bash. But Zsh's syntax is not completely compatible with bash (zsh breaks POSIX compliance.)

Config

bash reads .bashrc in non-login interactive shells (but macOS starts a login shell in terminals by default), .profile or .bash_profile in login shells, and .inputrc.

Zsh reads .zshrc in interactive shells and .zprofile in login shells.

Default Shell on macOS and other OS

In 2019, macOS Catalina adopted Zsh as the default login shell

macOS ships with bash 3.x, GPL v2; newer bash use GPLv3+; zsh is using MIT like license.

In 2020, Kali Linux (Debian-derived, primarily for digital forensics and penetration testing) adopted Zsh as the default shell.

ohmyzsh

https://github.com/ohmyzsh/ohmyzsh

Suggested plugins to enable:

alias-tips
common-aliases
extract
fasd
history
tmux
zsh-completions

How to Change PowerLevel10k Color?

Open the config file:

$ vim ~/.p10k.zsh

Change POWERLEVEL9K_DIR_BACKGROUND or other similar fields. The color is a number between 0 and 255, where 0 to 15 depend on the theme, while 16 to 255 are constant. To see the list of colors:

$ for i in {0..255}; do print -Pn "%K{$i}  %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done

e.g. change the background to green

# Current directory background color.
typeset -g POWERLEVEL9K_DIR_BACKGROUND=28

Apply the changes:

. ~/.p10k.zsh