News for hackers. Stuff that matters.
Re:Console productivity hack: Discover the frequent; then ma... by rcfox on Sunday October 10, 2010 @01:53AM (#1776629)
The `cdto` functionality (and then some) already exists in many shells, even the Windows shell.

`pushd` switches directories and maintains a stack of visited directories. `popd` pops the previous directory off the stack and then switches to it.

In zsh, it seems that `cd` is an alias for `pushd`. You can `cd` to a directory, then `popd` to go back.

In Windows, `pushd` seems to the easiest/only way to navigate to network directories on the command-line.

Re:Console productivity hack: Discover the frequent; then ma... by koenigdavidmj on Sunday October 10, 2010 @03:11AM (#1776726)
You can also say `cd -` on Bourne shells to go back to the previously visited directory. If you move from A to B in this manner and then run it again, then you will go back to A.

Also, `alias cd=pushd` to get that same zsh functionality in other Bourne shells.

Re:Console productivity hack: Discover the frequent; then ma... by yason on Sunday October 10, 2010 @03:58AM (#1776766)
I often find this idiomatic as well, both in scripts and on the command line:

  dostuff
  ( cd $directory && otherstuff )
  morestuff