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

It's really handy if you need to jump back and forth between two directories with diverse paths.


For that I usually use pushd.

  [chronomex@gir ~]$ mkdir test1 test2
  [chronomex@gir ~]$ cd test2
  [chronomex@gir ~/test2]$ pwd
  /home/chronomex/test2
  [chronomex@gir ~/test2]$ pushd ../test1
  ~/test1 ~/test2
  [chronomex@gir ~/test1]$ pwd
  /home/chronomex/test1
  [chronomex@gir ~/test1]$ pushd
  ~/test2 ~/test1
  [chronomex@gir ~/test2]$ pwd
  /home/chronomex/test2
  [chronomex@gir ~/test2]$


On older systems you had to do a fairly complicated set up for pushd/popd yourself. I did once in along 1998 or so, but never bothered again, since the great majority of the time "cd -" was good enough.


the command go with pushd is popd,which pop the last path you pushed into the queue.




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

Search: