brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: CDPATH lets cd jump to a folder from anywhere in your shell

Shell
~/tips/tip-shell-cdpath-jump-folders

export CDPATH=.:~/dev:~/dev/work

Lets cd find folders by name in a list of parent directories.

I keep my project folders in one place, and typing the full path gets old.

export CDPATH=.:~/dev:~/dev/work
cd myproject

cd looks for the name in each directory of CDPATH, in order, and prints the folder it entered. Always start with . so that folders in the current directory win. Put the export in your .bashrc or .zshrc but not in scripts, where it can change what a cd does.

Further reading: Bash manual: Bourne Shell Variables

More Shell tips zmv -n '(*).log' '$1.txt' zoxide query -ls project f=$(mktemp --suffix=.json) shopt globskipdots echo $EPOCHSECONDS All Shell tips (78) All topics

Link