Prasanna Natarajan

Bash cd wildcard alias function

Quickly add this to your .bashrc or wherever you have your favorites bash aliases setup:

cdp() {
  cd *$1*
}

You are welcome!

For the clueless

Imagine are navigating around folders in a terminal.

In your current directory, you have two dirs named:

Let’s suppose you want to navigate to the second one.

Normally this is what you’ll do:

With the above function though, all you have to do is:

cdp bus

You are now already into that folder!