Skip to content

Instantly share code, notes, and snippets.

@tbielawa tbielawa/cd_hacks.sh
Created Sep 17, 2019

Embed
What would you like to do?
Quick directory `cd`/shell hacks
# Make a named directory and change immediately into it
#
# pwd -> /tmp/cdhacks
# $ cdmkdir zerocool; pwd -> /tmp/cdhacks/zerocool
function cdmkdir () {
mkdir -p ${1} && cd ${1}
}
# Make a temp directory, add it to the top of the directory stack.
# Immediately switch into it.
#
# pwd -> /tmp/cdhacks/zerocool
# $ gotemp; pwd -> /tmp/tmp.ZMRBdB1L6r
# $ popd
# pwd = /tmp/cdhacks/zerocool
alias gotemp='pushd `mktemp -d`'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.