Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In bash, you can just cd - to pop back to the previous working directory, like popd without the pushd.

I also set .bash_profile aliases to quickly cd up the directory tree with just dots. It's silly, but surprising helpful.

  alias ..='cd ..'
  alias ...='cd ../..'
  alias ....='cd ../../..'


I did some Googling and was not satisfied with any of the solutions (pushd/popd, aliases, CDPATH etc.). That's why I wrote this. Works fine for me :)

PS: The whole story on my blog https://chanux.wordpress.com/2012/08/09/no-more-cd-dot-dot-s...


I like that idea, I could definitely see it being helpful. I've type cd.. too many times when I meant to say cd ..


me too. That's why I also:

  alias cd..='cd ..'
:)


At least '..' is defined by default in zsh.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: