Harness the Combinatoric Power of Command-Line Tools and Utilities

../Tips

Use CDPATH to Access Directories Faster

commands

Published May 31, 2024

Set the CDPATH environment variable to include frequently used directories. This allows you to cd into them from anywhere.

For example, if you have software projects in the ~/dev/ruby and ~/dev/go directories, and web sites in the ~/websites directory, you can set CDPATH to include those directories so you can jump to the folders

export CDPATH=.:~/dev/ruby:~/dev/go:~/websites

Including the current working directory (.) ensures you can still navigate to subdirectories without specifying a full path.

You can add this to your shell configuration files to make it permanent.