Stack Exchange network consists of 175 Q&A communities includingStack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Detailed answers to any questions you might have

Discuss the workings and policies of this site

Learn more about hiring developers or posting ads with us

By using our site, you acknowledge that you have read and understand ourCookie PolicyPrivacy Policy, and ourTerms of Service.

Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

The best answers are voted up and rise to the top

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

If I have multiple copies of the same application on the disk, and only one is running, as I can see withps, how can I know theabsolutepath to distinguish it from the others?

% ps -auxwe grep 24466 root 24466 0.0 0.0 1476 280 ? S 2009 0:00 supervise sshd % sudo ls -l /proc/24466/exe lrwxrwxrwx 1 root root 0 Feb 1 18:05 /proc/24466/exe –


In my system (ubuntu 14.04) you do not have to be superuser to run the

ls: cannot read symbolic link proc28783exe: Permission denied

command, its about accessing the process info of a process not belonging to you. On my box, about 97% of all processes listed in /proc are root processes, and the others are distributed over 11 different users.

This gives you the current working directory of the pid, not its absolute path.

Usually thewhichcommand will tell you which is being invoked from the shell:

@Kokizzu No, it doesnt because it doesnt answer the question at all. The which command only tells you which binary will be run if you execute the command now. The question was which binary is already running there. Imagine for example having a dozen jdks on your computer. If you want to know for a running java process which jdk its been taken from, which doesnt help you with that. It will only tell you which jdk it will be taken from, if you execute it now. The accepted answer is also the correct one.

An obvious way this answer is wrong: on my machine I run processes with different JDK versions and some 32bits/64bits. If I want to identify the correct jstack/jmap version for the process the answer above will not work while the accepted answer will.

@Kokizzu This only answers the question, What is the current working directory of the process

? The edited post still doesnt answer the question.

merely tells If the command is on the path, then what is it?

return me the absolute path of the exectuable program of the process depending on pid on redhat x64 6.3.

didnt work for a specific service, it just provide the relative path

Helped me identify a process via the command it was started with.

does not show ALL full qualified paths on my linux: root 24466 0.0 0.0 1476 280 ? S 2009 0:00 supervise sshd for example

This is more accurate than the other answers… maybe not as useful, but more the right answer. Upvoted.

The quick answer is to usepswith options or the/procfilesystem info. That willusuallywork, but is not guaranteed. In general, there is no definite, guaranteed answer. For instance, what if the executing file is deleted during execution, so that there is no path to the file?

Seethe Unix FAQfor a little more detail, particularly questions 4.3 and 4.4.

Why does everyone expect you to know the PID? Heres the human-friendly way:

lsof is an option. You can try something like below:

This will list all the files opened by the process including the executables actual location. It is then possible to add a few more awk, cut, grep etc. to find out the information that you are looking for.

As an example, I executed the following commands to identify where my java process came from:

By clicking Post Your Answer, you agree to ourterms of serviceprivacy policyandcookie policy

Unicorn Meta Zoo 3: How do we grade questions?

What are the words for people who cause trouble believing they know better?

Whats the correct term for a waitress in the Middle Ages?

Does Peachs float negate shorthop knockback multipliers?

In this example, which path would a monster affected by the Dissonant Whispers spell take?

How to skip replacing first occurrence of a character in each line?

How certain is a caster of when their spell will end?

Company is asking me to work from overseas, but wants me to take a paycut

Is the decompression of compressed and encrypted data without decryption also theoretically impossible?

Linux tr to convert vertical text to horizontal

What is the advantage of carrying a tripod and ND-filters when you could use image stacking instead?

What happens to foam insulation board after you pour concrete slab?

How bad would a partial hash leak be, realistically?

Is it a problem that pull requests are approved without any comments

Prove that a function is indefinitely differentiable

How could a possessed body begin to rot and decay while it is still alive?

Why is c4 bad when playing the London against a Kings Indian?

What does War Machines Canopy! Canopy! line mean in Avengers: Endgame?

Java 8: How to convert String to MapString,ListString?

Is there any word or phrase for negative bearing?

Why is Colorado so different politically from nearby states?

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo 2019 Stack Exchange Inc; user contributions licensed undercc by-sa 3.0withattribution required.rev2019.5.31.33856