Find a users working directory
First, perform a w or a who to find out which pseudo-terminal the user is using:
# w | grep "oracle" oracle pts/12 Fri 3pm 3days -bash
Now, we can find out the PID of the shell they’re using:
# ps -ef | grep '[p]ts/12' oracle 11918 11916 0 May 18 pts/12 0:00 -bash
Finally, use the pwdx command to find the pwd of the process:
# pwdx 11918 11918: /var/opt/oracle
Cheers,
Kevin
Categories: Solaris