1

this is the command to view the process path on Linux

ps -auxwe | grep 24466    ( 24466 is only example )

but please advice is it possible to view the path of running process on Solaris

if yes what the ps syntax for Solaris?

3 Answers 3

3

You can use pwdx in solaris and linux.

pwdx <pid_number>

example:

pwdx $$
25711:  /export/home/pippo
1
  • pwdx emits the current working directory of a process. Per the Linux man page: "pwdx - report current working directory of a process" Per the Solaris man page: "pwdx Print the current working directory of each process." Jul 14, 2017 at 12:10
3

How can I know the absolute path of a running process?

If by "absolute path" you mean the full path of the running binary, this works on my installed copy of Solaris 11:

pmap PID | grep -v ':' | head 1 | awk '{ print $4 }'

Replace PID with the the process id of the process you're interested in.

pmap emits the address map of the process, including the full path of the source file for the mapping. This includes the actual binary, which is the first mapping line of the output. The first line of the output contains the process id and the process arguments. Note that the process arguments are not sufficient to fully identify the full path to the running executable file. The first few lines of actual address space mappings are mappings from the actual executing binary, listed with the full, absolute path of the binary.

Unfortunately, you need read access to the process map to get that information. I don't know of any way to get what you're looking for without having that access.

Edit: There's also /proc/[PID]/path/a.out on Solaris 11, which is a soft link to the actual binary:

In bash:

bash-4.1$ readlink /proc/$$/path/a.out
/usr/bin/bash

Note that /proc/$$/path/a.out is better than /proc/self/path/a.out:

bash-4.1$ readlink /proc/self/path/a.out
/usr/bin/readlink

Unfortunatly, if you don't have access to the process map via pmap, you likely won't have access to /proc/[PID]/path/a.out, as the permissions on /proc/[PID]/path for my Solaris 11 install are all 500 - only the owner and root have read and execute permissions on the directory.

1

/usr/ucb/ps auxwwww | grep 6851 worked for me on SunOS servername01 5.10 Generic_147440-25 sun4u sparc SUNW,Sun-Fire-V490

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .