| 1 |
.\" Copyright (C) 1994, 1995, Daniel Quinlan <[email protected]> |
| 2 |
.\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright (C) 2023, Alejandro Colomar <[email protected]> |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-3.0-or-later |
| 6 |
.\" |
| 7 |
.TH proc_pid_exe 5 2024-05-02 "Linux man-pages 6.9.1" |
| 8 |
.SH NAME |
| 9 |
/proc/pid/exe \- symbolic link to program pathname |
| 10 |
.SH DESCRIPTION |
| 11 |
.TP |
| 12 |
.IR /proc/ pid /exe |
| 13 |
Under Linux 2.2 and later, this file is a symbolic link |
| 14 |
containing the actual pathname of the executed command. |
| 15 |
This symbolic link can be dereferenced normally; attempting to open |
| 16 |
it will open the executable. |
| 17 |
You can even type |
| 18 |
.IR /proc/ pid /exe |
| 19 |
to run another copy of the same executable that is being run by |
| 20 |
process |
| 21 |
.IR pid . |
| 22 |
If the pathname has been unlinked, the symbolic link will contain the |
| 23 |
string \[aq]\ (deleted)\[aq] appended to the original pathname. |
| 24 |
.\" The following was still true as at kernel 2.6.13 |
| 25 |
In a multithreaded process, the contents of this symbolic link |
| 26 |
are not available if the main thread has already terminated |
| 27 |
(typically by calling |
| 28 |
.BR pthread_exit (3)). |
| 29 |
.IP |
| 30 |
Permission to dereference or read |
| 31 |
.RB ( readlink (2)) |
| 32 |
this symbolic link is governed by a ptrace access mode |
| 33 |
.B PTRACE_MODE_READ_FSCREDS |
| 34 |
check; see |
| 35 |
.BR ptrace (2). |
| 36 |
.IP |
| 37 |
Under Linux 2.0 and earlier, |
| 38 |
.IR /proc/ pid /exe |
| 39 |
is a pointer to the binary which was executed, |
| 40 |
and appears as a symbolic link. |
| 41 |
A |
| 42 |
.BR readlink (2) |
| 43 |
call on this file under Linux 2.0 returns a string in the format: |
| 44 |
.IP |
| 45 |
.in +4n |
| 46 |
.EX |
| 47 |
[device]:inode |
| 48 |
.EE |
| 49 |
.in |
| 50 |
.IP |
| 51 |
For example, [0301]:1502 would be inode 1502 on device major 03 (IDE, |
| 52 |
MFM, etc. drives) minor 01 (first partition on the first drive). |
| 53 |
.IP |
| 54 |
.BR find (1) |
| 55 |
with the |
| 56 |
.I \-inum |
| 57 |
option can be used to locate the file. |
| 58 |
.SH SEE ALSO |
| 59 |
.BR proc (5) |