My ZSH Config
Supported platforms are Ubuntu and macOS.
# Install base dependencies
sudo apt update
sudo apt install -y git zsh bat gpg wget zoxide
# Install eza
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install -y eza
# Ensure zsh is a valid login shell
grep -qxF '/usr/bin/zsh' /etc/shells || echo '/usr/bin/zsh' | sudo tee -a /etc/shells
mkdir -p "$HOME/.cache"
mkdir -p "$HOME/.config"
touch "$HOME/.cache/zshhistory"
# Clone and Install
git clone https://github.com/patrickdobler/zsh "$HOME/zsh-config"
cp -r "$HOME/zsh-config/.zshrc" "$HOME/.zshrc"
cp -r "$HOME/zsh-config/.config/zsh" "$HOME/.config/"
chsh -s /usr/bin/zsh# Install Ghostty
brew install --cask ghostty
brew install git eza bat jq mas zoxide
brew tap buo/cask-upgrade
mkdir -p "$HOME/.cache"
mkdir -p "$HOME/.config"
touch "$HOME/.cache/zshhistory"
# Clone and Install
git clone https://github.com/patrickdobler/zsh "$HOME/zsh-config"
cp -r "$HOME/zsh-config/.zshrc" "$HOME/.zshrc"
cp -r "$HOME/zsh-config/.config/zsh" "$HOME/.config/"
chsh -s /bin/zsh
- git - required to clone this repo and auto-download plugins on first startup
- zsh-syntax-highlighting - auto-downloaded on first startup for syntax highlighting
- zsh-autosuggestions - auto-downloaded on first startup for history-based suggestions
- eza - modern replacement for the command-line program ls
- bat - interactive
catreplacement used without paging - zoxide - smarter directory navigation using the
zcommand - jq - macOS-only dependency required by
caskcleanandcaskmigto read Homebrew's cask metadata - mas - macOS-only dependency used by
brew cu --include-masfor Mac App Store updates - homebrew-cask-upgrade - macOS-only dependency used by
brewup(addsbrew cu) - Ghostty - optional terminal emulator used in the macOS setup above
On the first shell startup, the config clones the pinned stable releases of zsh-autosuggestions and zsh-syntax-highlighting into ~/.config/zsh/plugins.
Ubuntu aliases and functions are only loaded on Linux systems with apt. Homebrew and Cask aliases and functions are only loaded on macOS.
| Keys | Action |
|---|---|
| shift+tab | Accept autosuggest |
| home | Move to the beginning of the line. If already at the beginning of the line, move to the beginning of the previous line, if any. |
| end | Move to the end of the line. If already at the end of the line, move to the end of the next line, if any. |
| del | Delete the character under the cursor. |
| ctrl+→ | Move forward one word, vi-style. |
| ctrl+← | Move to the beginning of the previous word, vi-style. |
| ctrl+backspace | Kill the word behind the cursor, without going past the point where insert mode was last entered. |
| ctrl+del | Kill from the cursor to the end of the line. |
The prompt displays the current directory and Git branch information. The branch name is color-coded based on the repository state:
- Green: Clean repository.
- Yellow: Staged changes pending commit.
- Red: Unstaged changes or untracked files.
aptcRemove unused packages and cached package files.aptfShow information about a package.aptiInstall one or more packages.aptlList installed packages.aptoList packages with available updates.aptpRemove packages including their configuration files.aptrRemove one or more packages.aptsSearch for packages.aptuUpdate package indexes.aptUUpgrade installed packages without refreshing package indexes first.aptupUpdate package indexes and then upgrade installed packages.
Docker aliases and functions are loaded only when the docker command is installed on Ubuntu.
| Command | Description |
|---|---|
dps |
List running containers alphabetically with name and uptime. |
dpsa |
List all containers alphabetically with name, status, and uptime. |
dports |
List running containers and their published ports. |
dlog CONTAINER |
Show the last 200 log lines from a container. |
dlogs CONTAINER |
Show the last 200 log lines and follow a container's logs. |
dexec CONTAINER COMMAND |
Run an interactive command in a container. |
dsh CONTAINER |
Open Bash in a container when available, otherwise open sh. |
dstart CONTAINER |
Start a container. |
dstop CONTAINER |
Stop a container. |
drestart CONTAINER |
Restart a container. |
drm CONTAINER |
Remove a stopped container. |
dstats |
Show a current resource-usage snapshot. |
dstatslive |
Show live container resource usage. |
dtop CONTAINER |
Show processes running in a container. |
dinspect OBJECT |
Show detailed Docker object metadata. |
dip CONTAINER |
Show a container's internal IP addresses by network. |
dc |
Run docker compose. |
dcls |
List Compose projects. |
dcps |
List containers in the current Compose project. |
dcup |
Start the Compose project in the background. |
dcbuild |
Build images and start the Compose project. |
dcforce |
Recreate all containers in the Compose project. |
dcupdate [SERVICE] |
Pull images and update the Compose project or selected services. |
dcpull |
Pull Compose images without recreating containers. |
dcdown |
Stop the Compose project and remove its containers and networks. |
dcstop |
Stop Compose services without removing their containers. |
dcstart |
Start existing Compose service containers. |
dcrestart |
Restart Compose services. |
dclog [SERVICE] |
Show the last 200 Compose log lines. |
dclogs [SERVICE] |
Show the last 200 Compose log lines and follow them. |
dcexec SERVICE COMMAND |
Run a command in a running Compose service. |
dcrun SERVICE COMMAND |
Run a one-off Compose container and remove it afterwards. |
dcconfig |
Render and validate the resolved Compose configuration. |
dcimages |
List images used by the Compose project. |
dctop |
Show processes running in Compose containers. |
dcevents |
Follow events from the Compose project. |
dimages |
List local images. |
dpull IMAGE |
Pull an image. |
drmi IMAGE |
Remove an image. |
dbuild |
Build an image. |
ddf |
Show Docker disk usage. |
dinfo |
Show Docker system information. |
dprune |
Interactively remove unused Docker data except volumes. |
diprune |
Interactively remove unused images. |
dcprune |
Interactively remove stopped containers. |
dnprune |
Interactively remove unused networks. |
dbprune |
Interactively remove unused build cache. |
dvprune |
Interactively remove unused volumes. |
dstatus |
Show the Docker systemd service status. |
dservice-start |
Start the Docker systemd service. |
dservice-stop |
Stop the Docker systemd service. |
dservice-restart |
Restart the Docker systemd service. |
dservice-enable |
Enable and immediately start the Docker systemd service. |
djournal |
Follow logs from the Docker systemd service. |
The cleanup aliases deliberately remain interactive and do not use --force, --volumes, or docker compose down -v.
ssh-startStart Ubuntu's SSH service.ssh-stopStop Ubuntu's SSH service.update-grubRegenerate Ubuntu's GRUB configuration.
catIfbatis installed, the alias uses it as acatreplacement without paging.
showHiddenShow hidden files in the Finder.hideHiddenHide hidden files in the Finder.ooOpen the current directory in the Finder.
osupdateGet macOS software updates and update installed Homebrew and their installed packages.
ipShow the public IP address of the machine.localipShow the local IP address of the machine.dnsShow the DNS servers used by the machine.
lscleanupClean up LaunchServices to remove duplicates in the "Open With" menu.
dscleanRecursively delete.DS_Storefiles.drRead the "defaults" values.
brewaauto uninstalls formulae that are no longer needed.brewccleans the cache.brewCscrubs the cache, including downloads for the latest versions.brewdchecks your system for potential problems.breweedits given formula.brewfshows information about given formula.brewiinstalls given formula.brewllists installed formulae.brewLlists installed formulae that don't depend on other installed formula.brewolists outdated installed formulae.brewpremoves all cache files older than 30dbrewrreinstalls given formula.brewsperforms a search of formula names.brewSmanages background services with macOS' launchctl daemon manager.brewtlist installed packages with all dependenciesbrewuupdates Homebrew and all formulae.brewUupgrades outdated formulae.brewxuninstalls a given formula.brewXdeletes all installed versions of given formula.brewupupdates Homebrew and formulae, cleans and migrates casks, updates all casks including apps with built-in update mechanisms and Mac App Store apps, cleans the cache, and runs diagnostics.
caskcleanremoves installed casks whose application is missing and permanently deletes selected Mac App Store applications left in the Trash beforebrew cucan reinstall them. Root-owned App Store bundles require administrator privileges.caskmigmigrates manually installed applications to Homebrew Cask, recognises Cask tokens with the common-appsuffix, and loads matching Cask metadata in one batch for fast scans. The local function is adapted from cask-migrator.caskeedits given cask.caskfshows information about given cask.caskiinstalls given cask.caskllists installed casks.caskolists outdated installed casks.caskrreinstalls given cask.casksperforms a search of cask tokens.caskUupgrades given cask or all outdated casks, if none given.caskxuninstalls given cask.caskXuninstalls even if given cask does not appear to be present.caskzzaps all files associated with given cask.
These aliases are shortcuts for the eza command, a modern replacement for ls.
lShow files and directories usingeza's default view.laShow almost all files and directories in long format with size, type, and human-readable format.lrShow files and directories sorted by date in long format with size, type, and human-readable format.ltShow files and directories sorted by date in long format with size, type, and human-readable format.llShow files and directories in long format with size, type, and human-readable format.ldotList dot files.loneShow files and directories in one line with indicators.lrtShow files and directories in one line with indicators in reverse order.lsrRecursive list of files and directories in long format with size, type, and human-readable format.lamcShow files and directories in long format with size, type, and human-readable format, and access, modified, and created date.llgShow files and directories in long format with size, type, and human-readable format in grid view.treeShow the directory structure in a tree format up to a depth of 2.treelShow files and directories in long format in a tree view up to a depth of 2.treelaShow almost all files and directories in long format with size, type, and human-readable format, including dot files, in a tree format up to a depth of 2.
If eza is not installed, these aliases are shortcuts for the ls command.
lShow files and directories with size, type, and human-readable format.laShow almost all files and directories in long format with size, type, and human-readable format.lrShow files and directories sorted by date in long format with size, type, and human-readable format.ltShow files and directories sorted by date in long format with size, type, and human-readable format.llShow files and directories in long format with size, type, and human-readable format.ldotList dot files.lSSort files and directories by size in a single column.lartSort files and directories by access time in a single column.lrtSort files and directories by modification time in a single column.lsrRecursive list of files and directories in long format with size, type, and human-readable format.lsnA column contains name of files and directories.treeShow the directory structure in a tree format up to any depth.
grepEnable colored output forgrep.sgrepRecursive search with line numbers and context for non-version control directories.
tShow the last few lines of a file and follow it as it updates.HShow the first few lines of output.TShow the last few lines of output.GFilter output with grep.LShow output inlesswith pagination.MShow output inmostwith pagination.LLShow all output inless.CAShow all output with non-printing characters.NEHide all error output.NULHide all output.PColorize Python traceback output.
dudShow the size of directories in the current directory.dufShow the size of files and directories in the current directory.dusShow the size of directories sorted by size in the current directory.fdFind directories with a specific name.ffFind files with a specific name.filecountShow the number of files in the current directory.
hShow the command history.hgrepSearch command history.helpShow the manual for a command.pShow information about running processes.sortnrSort in reverse numeric order.unexportRemove an environment variable.rm,cp,mvPrompt before overwriting or deleting files.mdCreate a directory and any necessary parent directories...,...Change the directory to the parent directory or grandparent directory.clsClear the terminal screen.topIf you have thehtopprocess monitoring tool installed on your system, the alias will overwritetopwithhtop
zChange to a frequently used directory by matching part of its path.
The extract function is a utility function that can extract files from a variety of compressed formats. To use the function, simply call it with the name of the compressed file(s) you want to extract, like so:
extract -v file1.tar.gz file2.zipThe gitpush function stages all changes, creates a commit with the message you pass in, and pushes the current branch.
The gitupdate function starts ssh-agent, adds ~/.ssh/github, and tests the connection to GitHub.