CDPATH

noun

say it: “SEE DEE path” /ˌsiˌdi ˈpæθ/

A shell setting that lists folders where cd also looks for the folder you name, so you can reach them from anywhere.

What is CDPATH?

CDPATH is a list of folders, separated by colons like PATH, where cd also looks when you name a folder that isn't in the one you're in. With your projects folder on the list, cd raw works from anywhere. Start the list with . so a folder right here still wins, and keep it short: a surprise match takes you somewhere you didn't expect.

CDPATH=.:$HOME/terminal-practice/photo-project
cd raw               # works from any folder

In a sentence

  • “With the photo project on CDPATH, cd raw worked from Sam's home folder.”
  • “Sam started CDPATH with a dot, so a folder in the current one still came first.”

Level: Journeyman · More Unix terms at this level

Updated