Goto last visted directory

Dear All,

Can any one pls let me the command for how to goback to previous visited directory from the current working directory in SunOS ?

In case of HP-UX; the same can be resolved through "cd -" command.

Thanks in advance!
Prasanth Babu.

the command is shell and not os dependent!

use: "echo $SHELL" inside the both os. the default shell in solaris is "sh". you can change the shell by typing "ksh" and then the "cd -" command should work again...

Ok.
Thanks on this ...

am sure u can do the same using "bash" too

You can use pushd and popd.

ie:
pwd = /var/adm

if you type pushd /usr/local you will be in /usr/local
then if you type popd you will go back to /var/adm

Hi

I have similar query. Did u got command to goback to previous visited directory from the current working directory in SunOS

Can u please share with me too...

Thanks
Surbhi

The question has already been answered in this thread so I assume it wasn't clear enough.

For this feature to work, you need to use a shell that support it. The default shell Solaris use (/bin/sh) doesn't so you need to switch to another one.

Ask your administrator to switch your shell to /bin/ksh (or better /bin/ksh93 if available). If you are that person , simply run "usermod -s /bin/ksh surbhi" assuming surbhi is your loginname. If you are only login in as root, create a user account first and use it instead of root.