About This Article
This article is created using an automated generation workflow powered by generative AI. Based on Linux kernel procfs documentation and existing executed Daily-Code-Samples, it verifies:/proc/selfobserves who refers to whom through safe, read-only operations.
Verification Status: 🧪 Locally verified on Debian 13 / Bash 5.2.37; Ubuntu actual hardware unverified
/proc is not a collection of ordinary disk folders, but a virtual file system where the kernel exposes processes and system states in a file-like format. First, read only your own PID, and/proc/self observe a somewhat unexpected behavior of.
Run First
May contain sensitive information /proc/*/environ will not be touched.status of Name/Pid/PPid read only.
echo "[SHELL] Bash PID = $$"
echo '[OBSERVE 1] /proc/$$/status'
awk '/^(Name|Pid|PPid):/ {print}' "/proc/$$/status"
echo '[OBSERVE 2] /proc/self/status'
awk '/^(Name|Pid|PPid):/ {print}' /proc/self/status
The basics of procfs can be found in the Linux kernel documentation.
View Here
In the first case, Pid matches Bash's own $$. However, in the second case, depending on the environment, it becomes Name: awk and the PID differs from Bash.
This is because /proc/self of self refers not to "the shell that wrote the command," but tothe process that actually references that path. In this example, awk opens /proc/self/status.
flowchart LR
B["Bash PID = $$"] --> A[awkを起動]
A --> P["/proc/self/status をopen"]
P --> K["Kernel / procfs"]
K --> R[awk自身のPidを返す]
Change One Part
This time, instead of self, explicitly specify Bash's PID.
cat "/proc/$$/cmdline" | tr '\0' ' ' echo
/proc/$$Since fixes the target PID, even if another process's cat reads it, the reference target remains Bash.
Why It Looks Like Files
procfs is an interface that exposes internal kernel information to user space.statusWhen reading , rather than thinking of it as opening a saved text file, it is easier to understand if you view it as "the kernel presenting the current state in a file-like manner."
Once you understand this concept,ps it becomes easier to trace what information Linux exposes behind
and monitoring tools.
/procWhile
/proc/*/environcontains useful information, it does not mean any data should be output to articles or logs.may contain environment variables and sensitive information
Other users' processes may appear differently depending on permissions and mount configurations
PIDs that terminate instantly may disappear during observation
Because this is a Linux-specific mechanism, do not generalize it directly to other OSs
When troubleshooting, it is safer to read only the required items.
GitHub Samples[START] / [OBSERVE] / [SUCCESS]Existing samples display
Daily-Code-Samples — proc-self-inspect
Linux Kernel Documentation — The /proc Filesystem
/proc/<PID>Summary/proc/self represents the specified process, while represents the process itself referencing that path. Even through a small reading experiment, you can experience how Linux exposes kernel state as a file-like interface.

