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

pushd / popd where have you been all my life?! How did I not know this? Thanks Zed!


Related to that... the 'cd' section seems to be missing "cd -" (ATM).

    $ cd /some/really/long/dir
    $ pwd
    /some/really/long/dir
    $ cd ~
    $ pwd
    ~
    $ cd -
    $ pwd
    /some/really/long/dir
I'm pretty sure "cd" and "cd -" are my most used commands. CDPATH ranks pretty important too.


What is the difference between the three?


~ is your home directory. - is the last directory you ran cd from. For CDPATH see this http://www.caliban.org/bash/#bashtips



`please` don't use this in scripts. It makes it so hard to debug things later when the next guy comes along and has no idea where you end up after you pop. (can you tell this has been happening to me recently?!)




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

Search: