Skip to content

Instantly share code, notes, and snippets.

@wetherc
Created October 19, 2017 00:27
Show Gist options
  • Save wetherc/4d346cd2f85a34ffbe5162b9b31cd5d6 to your computer and use it in GitHub Desktop.
Save wetherc/4d346cd2f85a34ffbe5162b9b31cd5d6 to your computer and use it in GitHub Desktop.
Pushd / Popd example
# Do some work in my home directory
chriss-MacBook-Pro:~ chris$ pwd
/Users/chris
chriss-MacBook-Pro:~ chris$ vim myAwesomeCode.py
chriss-MacBook-Pro:~ chris$ python myAwesomeCode.py
# Switch directories real quick
chriss-MacBook-Pro:~ chris$ cd /etc
chriss-MacBook-Pro:etc chris$ vim hosts
# Go back to my original directory
# IMPORTANT: Here, I need to remember
# and explicitly specify what my
# previous directory was
chriss-MacBook-Pro:etc chris$ cd /Users/chris
chriss-MacBook-Pro:~ chris$ python myAwesomeCode.py
# Do some work in my home directory
chriss-MacBook-Pro:~ chris$ pwd
/Users/chris
chriss-MacBook-Pro:~ chris$ vim myAwesomeCode.py
chriss-MacBook-Pro:~ chris$ python myAwesomeCode.py
# Switch directories real quick
chriss-MacBook-Pro:~ chris$ pushd /etc
/etc ~
chriss-MacBook-Pro:etc chris$ vim hosts
# Go back to my original directory
# IMPORTANT: I don't need to know what
# directory I had open before this!
chriss-MacBook-Pro:etc chris$ popd
~
chriss-MacBook-Pro:~ chris$ python myAwesomeCode.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment