Skip to content

Instantly share code, notes, and snippets.

@victorloux
Created April 29, 2017 12:43
Show Gist options
  • Save victorloux/80fde1c522b2841af55dedab1015f4a8 to your computer and use it in GitHub Desktop.
Save victorloux/80fde1c522b2841af55dedab1015f4a8 to your computer and use it in GitHub Desktop.
cd into the most recently created directory
# this creates the command "cr" which will cd into the most recently created directory
# useful after using mkdir, git clone, unzip etc.
# no need to type "mkdir new-project && cd new-project"
# just "mkdir new-project" then "cr"!
# !! WORKS ON macOS only (Linux doesn't have creation times)
# but it can surely be adapted with some hack on the modified time
alias cr=cd (ls -tUd */ | head -n 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment