How do I determine the path to a binary of a process?
Is there a way to find out the directory/disk location a process was started from? I am aware of the /proc mount but not really where to look inside of it.
process
add a comment |
Is there a way to find out the directory/disk location a process was started from? I am aware of the /proc mount but not really where to look inside of it.
process
1
Do you mean the location of the binary, or the directory from which a process started?
– Lekensteyn
Jun 16 '11 at 10:59
Sorry for the ambiguity, I mean the binary
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
Is there a way to find out the directory/disk location a process was started from? I am aware of the /proc mount but not really where to look inside of it.
process
Is there a way to find out the directory/disk location a process was started from? I am aware of the /proc mount but not really where to look inside of it.
process
process
edited Jun 16 '11 at 12:08
Lekensteyn
123k49270361
123k49270361
asked Jun 16 '11 at 10:47
SuperJumboSuperJumbo
229247
229247
1
Do you mean the location of the binary, or the directory from which a process started?
– Lekensteyn
Jun 16 '11 at 10:59
Sorry for the ambiguity, I mean the binary
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
1
Do you mean the location of the binary, or the directory from which a process started?
– Lekensteyn
Jun 16 '11 at 10:59
Sorry for the ambiguity, I mean the binary
– SuperJumbo
Jun 16 '11 at 11:11
1
1
Do you mean the location of the binary, or the directory from which a process started?
– Lekensteyn
Jun 16 '11 at 10:59
Do you mean the location of the binary, or the directory from which a process started?
– Lekensteyn
Jun 16 '11 at 10:59
Sorry for the ambiguity, I mean the binary
– SuperJumbo
Jun 16 '11 at 11:11
Sorry for the ambiguity, I mean the binary
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
5 Answers
5
active
oldest
votes
The /proc
way would be to inspect the exe
link in the directory corresponding to the pid.
Let's take an example with update-notifier
:
Find the pid, which is 15421 in this example:
egil@gud:~$ ps x | grep update-notifier
2405 pts/4 S+ 0:00 grep update-notifier
15421 ? Sl 0:00 update-notifier
Look up the symbolic link:
egil@gud:~$ file /proc/15421/exe
/proc/15421/exe: symbolic link to `/usr/bin/update-notifier'
Oh yeah, I was almost there. Legend, thank you.
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
Maybe which
is what you are looking for. For instance, on my system
which firefox
returns
/usr/bin/firefox
See also Find Path of Application Running on Solaris, Ubuntu, Suse or Redhat Linux .
6
which
is cool, but it only returns programs in your $PATH. If I runRandomProgramIDownloadedToErisKnowsWhere.bin
, this won't be of much use.
– djeikyb
Jun 16 '11 at 11:02
add a comment |
Providing you've a process ID available, you can use:
readlink -f /proc/$pid/exe
(replace $pid
by the process ID of a process)
If the process is not owned by you, you'll have to put sudo
in front of it.
An example for determining the location of the command firefox
:
The output of
ps ax -o pid,cmd | grep firefox
:
22831 grep --color=auto firefox
28179 /usr/lib/firefox-4.0.1/firefox-bin
28179
is the process ID, so you've to run:
readlink -f /proc/28179/exe
which outputs:
/usr/bin/firefox
2
You can do cool things with/proc/$pid/exe
, if the binary is accidentally deleted, you can restore it with:dd if=/proc/$pid/exe of=restored-binary
– Lekensteyn
Jun 16 '11 at 11:05
add a comment |
Press Ctrl+Alt+T to go to a terminal and type:
ls -al /proc/{pid}/fd
and then check the output
This will list all the files your process is associated with...
Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
– Fabby
Jul 4 '18 at 17:05
add a comment |
All the commands in the other answers are good, but you could do even more - seeing how some process has been actually run before it got to the process list.
Run in terminal:
top
And while it is running, press keyboard C
and you will get a command of the processes that was run.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f49024%2fhow-do-i-determine-the-path-to-a-binary-of-a-process%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
The /proc
way would be to inspect the exe
link in the directory corresponding to the pid.
Let's take an example with update-notifier
:
Find the pid, which is 15421 in this example:
egil@gud:~$ ps x | grep update-notifier
2405 pts/4 S+ 0:00 grep update-notifier
15421 ? Sl 0:00 update-notifier
Look up the symbolic link:
egil@gud:~$ file /proc/15421/exe
/proc/15421/exe: symbolic link to `/usr/bin/update-notifier'
Oh yeah, I was almost there. Legend, thank you.
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
The /proc
way would be to inspect the exe
link in the directory corresponding to the pid.
Let's take an example with update-notifier
:
Find the pid, which is 15421 in this example:
egil@gud:~$ ps x | grep update-notifier
2405 pts/4 S+ 0:00 grep update-notifier
15421 ? Sl 0:00 update-notifier
Look up the symbolic link:
egil@gud:~$ file /proc/15421/exe
/proc/15421/exe: symbolic link to `/usr/bin/update-notifier'
Oh yeah, I was almost there. Legend, thank you.
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
The /proc
way would be to inspect the exe
link in the directory corresponding to the pid.
Let's take an example with update-notifier
:
Find the pid, which is 15421 in this example:
egil@gud:~$ ps x | grep update-notifier
2405 pts/4 S+ 0:00 grep update-notifier
15421 ? Sl 0:00 update-notifier
Look up the symbolic link:
egil@gud:~$ file /proc/15421/exe
/proc/15421/exe: symbolic link to `/usr/bin/update-notifier'
The /proc
way would be to inspect the exe
link in the directory corresponding to the pid.
Let's take an example with update-notifier
:
Find the pid, which is 15421 in this example:
egil@gud:~$ ps x | grep update-notifier
2405 pts/4 S+ 0:00 grep update-notifier
15421 ? Sl 0:00 update-notifier
Look up the symbolic link:
egil@gud:~$ file /proc/15421/exe
/proc/15421/exe: symbolic link to `/usr/bin/update-notifier'
edited Jun 16 '11 at 11:07
answered Jun 16 '11 at 10:56
EgilEgil
10.7k23446
10.7k23446
Oh yeah, I was almost there. Legend, thank you.
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
Oh yeah, I was almost there. Legend, thank you.
– SuperJumbo
Jun 16 '11 at 11:11
Oh yeah, I was almost there. Legend, thank you.
– SuperJumbo
Jun 16 '11 at 11:11
Oh yeah, I was almost there. Legend, thank you.
– SuperJumbo
Jun 16 '11 at 11:11
add a comment |
Maybe which
is what you are looking for. For instance, on my system
which firefox
returns
/usr/bin/firefox
See also Find Path of Application Running on Solaris, Ubuntu, Suse or Redhat Linux .
6
which
is cool, but it only returns programs in your $PATH. If I runRandomProgramIDownloadedToErisKnowsWhere.bin
, this won't be of much use.
– djeikyb
Jun 16 '11 at 11:02
add a comment |
Maybe which
is what you are looking for. For instance, on my system
which firefox
returns
/usr/bin/firefox
See also Find Path of Application Running on Solaris, Ubuntu, Suse or Redhat Linux .
6
which
is cool, but it only returns programs in your $PATH. If I runRandomProgramIDownloadedToErisKnowsWhere.bin
, this won't be of much use.
– djeikyb
Jun 16 '11 at 11:02
add a comment |
Maybe which
is what you are looking for. For instance, on my system
which firefox
returns
/usr/bin/firefox
See also Find Path of Application Running on Solaris, Ubuntu, Suse or Redhat Linux .
Maybe which
is what you are looking for. For instance, on my system
which firefox
returns
/usr/bin/firefox
See also Find Path of Application Running on Solaris, Ubuntu, Suse or Redhat Linux .
answered Jun 16 '11 at 10:51
N.N.N.N.
8,499154988
8,499154988
6
which
is cool, but it only returns programs in your $PATH. If I runRandomProgramIDownloadedToErisKnowsWhere.bin
, this won't be of much use.
– djeikyb
Jun 16 '11 at 11:02
add a comment |
6
which
is cool, but it only returns programs in your $PATH. If I runRandomProgramIDownloadedToErisKnowsWhere.bin
, this won't be of much use.
– djeikyb
Jun 16 '11 at 11:02
6
6
which
is cool, but it only returns programs in your $PATH. If I run RandomProgramIDownloadedToErisKnowsWhere.bin
, this won't be of much use.– djeikyb
Jun 16 '11 at 11:02
which
is cool, but it only returns programs in your $PATH. If I run RandomProgramIDownloadedToErisKnowsWhere.bin
, this won't be of much use.– djeikyb
Jun 16 '11 at 11:02
add a comment |
Providing you've a process ID available, you can use:
readlink -f /proc/$pid/exe
(replace $pid
by the process ID of a process)
If the process is not owned by you, you'll have to put sudo
in front of it.
An example for determining the location of the command firefox
:
The output of
ps ax -o pid,cmd | grep firefox
:
22831 grep --color=auto firefox
28179 /usr/lib/firefox-4.0.1/firefox-bin
28179
is the process ID, so you've to run:
readlink -f /proc/28179/exe
which outputs:
/usr/bin/firefox
2
You can do cool things with/proc/$pid/exe
, if the binary is accidentally deleted, you can restore it with:dd if=/proc/$pid/exe of=restored-binary
– Lekensteyn
Jun 16 '11 at 11:05
add a comment |
Providing you've a process ID available, you can use:
readlink -f /proc/$pid/exe
(replace $pid
by the process ID of a process)
If the process is not owned by you, you'll have to put sudo
in front of it.
An example for determining the location of the command firefox
:
The output of
ps ax -o pid,cmd | grep firefox
:
22831 grep --color=auto firefox
28179 /usr/lib/firefox-4.0.1/firefox-bin
28179
is the process ID, so you've to run:
readlink -f /proc/28179/exe
which outputs:
/usr/bin/firefox
2
You can do cool things with/proc/$pid/exe
, if the binary is accidentally deleted, you can restore it with:dd if=/proc/$pid/exe of=restored-binary
– Lekensteyn
Jun 16 '11 at 11:05
add a comment |
Providing you've a process ID available, you can use:
readlink -f /proc/$pid/exe
(replace $pid
by the process ID of a process)
If the process is not owned by you, you'll have to put sudo
in front of it.
An example for determining the location of the command firefox
:
The output of
ps ax -o pid,cmd | grep firefox
:
22831 grep --color=auto firefox
28179 /usr/lib/firefox-4.0.1/firefox-bin
28179
is the process ID, so you've to run:
readlink -f /proc/28179/exe
which outputs:
/usr/bin/firefox
Providing you've a process ID available, you can use:
readlink -f /proc/$pid/exe
(replace $pid
by the process ID of a process)
If the process is not owned by you, you'll have to put sudo
in front of it.
An example for determining the location of the command firefox
:
The output of
ps ax -o pid,cmd | grep firefox
:
22831 grep --color=auto firefox
28179 /usr/lib/firefox-4.0.1/firefox-bin
28179
is the process ID, so you've to run:
readlink -f /proc/28179/exe
which outputs:
/usr/bin/firefox
edited Jun 16 '11 at 11:03
answered Jun 16 '11 at 10:57
LekensteynLekensteyn
123k49270361
123k49270361
2
You can do cool things with/proc/$pid/exe
, if the binary is accidentally deleted, you can restore it with:dd if=/proc/$pid/exe of=restored-binary
– Lekensteyn
Jun 16 '11 at 11:05
add a comment |
2
You can do cool things with/proc/$pid/exe
, if the binary is accidentally deleted, you can restore it with:dd if=/proc/$pid/exe of=restored-binary
– Lekensteyn
Jun 16 '11 at 11:05
2
2
You can do cool things with
/proc/$pid/exe
, if the binary is accidentally deleted, you can restore it with: dd if=/proc/$pid/exe of=restored-binary
– Lekensteyn
Jun 16 '11 at 11:05
You can do cool things with
/proc/$pid/exe
, if the binary is accidentally deleted, you can restore it with: dd if=/proc/$pid/exe of=restored-binary
– Lekensteyn
Jun 16 '11 at 11:05
add a comment |
Press Ctrl+Alt+T to go to a terminal and type:
ls -al /proc/{pid}/fd
and then check the output
This will list all the files your process is associated with...
Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
– Fabby
Jul 4 '18 at 17:05
add a comment |
Press Ctrl+Alt+T to go to a terminal and type:
ls -al /proc/{pid}/fd
and then check the output
This will list all the files your process is associated with...
Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
– Fabby
Jul 4 '18 at 17:05
add a comment |
Press Ctrl+Alt+T to go to a terminal and type:
ls -al /proc/{pid}/fd
and then check the output
This will list all the files your process is associated with...
Press Ctrl+Alt+T to go to a terminal and type:
ls -al /proc/{pid}/fd
and then check the output
This will list all the files your process is associated with...
edited Jul 4 '18 at 17:05
Fabby
27k1360161
27k1360161
answered Jul 4 '18 at 5:24
xiaoyifangxiaoyifang
1572
1572
Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
– Fabby
Jul 4 '18 at 17:05
add a comment |
Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
– Fabby
Jul 4 '18 at 17:05
Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
– Fabby
Jul 4 '18 at 17:05
Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
– Fabby
Jul 4 '18 at 17:05
add a comment |
All the commands in the other answers are good, but you could do even more - seeing how some process has been actually run before it got to the process list.
Run in terminal:
top
And while it is running, press keyboard C
and you will get a command of the processes that was run.
add a comment |
All the commands in the other answers are good, but you could do even more - seeing how some process has been actually run before it got to the process list.
Run in terminal:
top
And while it is running, press keyboard C
and you will get a command of the processes that was run.
add a comment |
All the commands in the other answers are good, but you could do even more - seeing how some process has been actually run before it got to the process list.
Run in terminal:
top
And while it is running, press keyboard C
and you will get a command of the processes that was run.
All the commands in the other answers are good, but you could do even more - seeing how some process has been actually run before it got to the process list.
Run in terminal:
top
And while it is running, press keyboard C
and you will get a command of the processes that was run.
answered Feb 14 at 16:04
AleksAleks
197112
197112
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f49024%2fhow-do-i-determine-the-path-to-a-binary-of-a-process%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Do you mean the location of the binary, or the directory from which a process started?
– Lekensteyn
Jun 16 '11 at 10:59
Sorry for the ambiguity, I mean the binary
– SuperJumbo
Jun 16 '11 at 11:11