Command line productivity

There is nothing more rewarding than creating shortcuts for your daily work routines, and what better than when using the command line.


You have to create a directory and then cd to it after creation.


Open your blash_profile for editing, in my case I will use nano

$ nano ~/bash_profile

once open, now I can add the following function to it.

function mkcd()
mkdir -p $1 && eval cd $1

Almost there… now do control-x + enter + control-c, finally source blash_profile

$ source ~/.bash_profile

You are now set. next time you need to create a new directory and cd to it all you have to do is:

$ mkcd name_of_directory

← Back to home