Hacker News new | ask | show | jobs
by Morgawr 4538 days ago
Interesting scripts are being posted in the comments, really neat tricks guys.

One thing I'd like to add, if you're like me and don't want to install too much "extra" stuff on your machines: Bash has native commands called pushd and popd[0]. They work as a stack, pushd will push the current directory onto the stack and jump to the new target, then you're free to move around, do whatever you want and then call popd to pop the latest directory from the stack.

I find these very useful, especially if I'm on a machine without additional installed software and just want to do my thing effortlessly.

[0] http://en.wikipedia.org/wiki/Pushd_and_popd

1 comments

For a one-level undo there's always

  cd -
Passing a single dash as a parameter to cd takes you back to $OLDPWD and each invocation of cd sets OLDPWD to the directory you were in.