proc_pid_exe(5)
โจ NAME โจ
/proc/pid/exe โ a symbolic link that points at the pathname of a program, bestie ๐
๐ฆ DESCRIPTION ๐ฆ
/proc/pid/exe</p>
okay so under Linux 2.2 and later, this file is literally a symbolic link holding the actual pathname of the command that got executed. no cap ๐ฅ
you can dereference this symlink like a normal person would, and if you try to open it, surprise, you open the executable itself. iconic behavior honestly.
and get this โ you can even type /proc/pid/exe to run another copy of the exact same executable that process pid is running. yes really. the audacity. the range. ๐
now, if the pathname has been unlinked, the symlink will contain the string ' (deleted)' appended to the original pathname. so like, she's still wearing the old name but with a little tragedy sticker on it ๐ญ
in a multithreaded process, the contents of this symbolic link are not available if the main thread has already terminated (typically by calling pthread_exit(3)). so if the main character has left the group chat, the link's basically ghosted you. ๐
who's allowed to dereference or read (readlink(2)) this symbolic link? that's governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check, see ptrace(2). so the permissions vibe check happens at that gate ๐ธ
the Linux 2.0 and earlier era (throwback)
under Linux 2.0 and earlier, /proc/pid/exe is a pointer to the binary which was executed, and appears as a symbolic link. a readlink(2) call on this file under Linux 2.0 returns a string in the format:
[device]:inode
for example, [0301]:1502 would be inode 1502 on device major 03 (IDE, MFM, etc. drives) minor 01 (first partition on the first drive). yes that's the whole archaeology of it, periodt ๐บโจ
and if you need to find the actual file from that? find(1) with the -inum option can be used to locate the file. slay. ๐ซถ
๐ SEE ALSO ๐
lowkey important: if the pathname's unlinked you're getting that ' (deleted)' suffix, and if the main thread already dipped on a multithreaded process, the link contents just aren't there. that's not me being dramatic, that's the manpage fr fr ๐
and that's a wrap bestie!! this page is from Linux man-pages 6.20, dated 2026-02-08 ๐ keep slaying those symlinks, mwah ๐๐ธ๐ฆ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-3.0-or-later
- Copyright 1994-1995, Daniel Quinlan <Daniel.Quinlan@linux.org>
- Copyright 2002-2017, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms