Skip to content

Instantly share code, notes, and snippets.

@GoranLilja
Last active October 30, 2017 11:17
Show Gist options
  • Save GoranLilja/b5cc9639590a4a53cb4618e55446c195 to your computer and use it in GitHub Desktop.
Save GoranLilja/b5cc9639590a4a53cb4618e55446c195 to your computer and use it in GitHub Desktop.
Create directory and change to it

Add a quick way of creating a directory and change to it

  1. Open up your .bash_profile.

    nano ~/.bash_profile

  2. Add the following lines at the bottom of the file.

    mkcd() {
      mkdir $1
      cd $1
    }
    
  3. Reload your profile.

    source ~/.bash_profile

  4. Create your directory with mkcd.

    mkcd directory_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment