alwaysInBeta Stable software is for the weak

CDPATH date: 2014-04-14 02:51:29+00:00 categories: - Linux

In BASH (at least), CDPATH is a list that determines where "cd" tries to take you when not given a full/absolute path, much like PATH does for execution. For instance, my .bashrc contains the line

export CDPATH=":/home/brian/Dropbox/Programming/"

Which allows me to type "cd ruby" (for instance) from any directory on the system, and iff that directory doesn't contain a directory named ruby, then I'll end up in /home/brian/Dropbox/Programming/ruby. The list is colon-delimited, so the ":" at the start puts a null item, which BASH treats as the current directory (you could also explicitly use the current directory, i.e. ".:/home..."), so cd still checks the current directory first.