lsof -d cwd
will print the current working directories for all of your processes. If you want to show info on processes you don’t own, you need to run it as root (i.e. use sudo
as a prefix). If you want to show the info for only certain programs or processes, use e.g. lsof -a -d cwd -c programname
or lsof -a -d cwd -p processid
(note: in both cases, the -a
flag means that the other flags’ restrictions get “and”ed together). lsof
is pretty complex and has lots more options, so read its man page for more info.