89wc4q
Last Updated: February 25, 2016
·
1.623K
· gpakosz

CDPATH - cd to your project directory from anywhere

I cross posted this tip to my own site: http://pempek.net/articles/2014/01/01/cdpath-cd-from-anywhere/

My projects are organized the following way:

~
├── ...
├── Projects
│   ├── Project1
│   ├── Project2
│   └── Project3
└── ...

In your ~/.bash_profile, ~/.bashrc or ~/.zshrc just add:

CDPATH=.:~/Projects

Now enjoy being able to cd Project1, cd Project2 or cd Project3 from anywhere:

$ cd /
$ cd Project1
$ pwd
/home/gregory/Projects/Project1

2 Responses
Add your response

7133

Does this have any negative side effects such as when names collide with files in your current directory?

over 1 year ago ·
7142

Good point, I changed the tip so that . is searched first

over 1 year ago ·