December 06, 2015
The cool thing about programming is that you’re constantly discovering and seeking out faster ways of doing things. Sometimes you learn something later than you would have hoped, but better late than never! After countless times of mkdir’ing and then cd’ing into immediately after, I sought after a better way.
Before, I would do either this:
User $ mkdir /home/foo/doc/bar User $ cd /home/foo/doc/bar
OR, even better, combine it into a single command by using the
User $ mkdir /home/foo/doc/bar && cd /home/foo/doc/bar
However, instead of typing out the long directory name or chain, you can simply replace it with
User $ mkdir /home/foo/doc/bar && cd $_
It works the same, and I’m going to start using it to see if it soothes my impatience.
I'm Patrick El-Hage and I live and work in San Francisco. I'm also on Twitter.