proc(5)

โœจ NAME โœจ

proc โ€” process information, system information, and sysctl pseudo-filesystem ๐Ÿซถ

okay bestie, quick vibe check: this is proc(5), from the File Formats Manual section of the man pages. it's the page about the whole /proc situation. let's go ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so the proc filesystem is a pseudo-filesystem โ€” like, it's not real files on a disk, it's a window straight into kernel data structures โœจ it's commonly mounted at /proc. typically the system mounts it for you automatically (main character behavior tbh), but you can also mount it manually with a command like:

mount -t proc proc /proc

most of the files in /proc are read-only ๐Ÿฅบ but some of them are writable, which means you can actually change kernel variables through them. putting your hands directly on the machinery fr fr.

๐ŸŽ€ Mount options

the proc filesystem supports these mount options:

  • hidepid=n (since Linux 3.3) โ€” this one controls who can access the info inside the /proc/pid directories ๐Ÿ‘€ the argument, n, is one of these values:
    • 0 โ€” literally everybody can access all /proc/pid directories. this is the traditional behavior, and it's the default if you don't specify this mount option at all.
    • 1 โ€” users may not access files and subdirectories inside any /proc/pid directories except their own (the /proc/pid directories themselves stay visible, they're just empty-looking for outsiders). sensitive files like /proc/pid/cmdline and /proc/pid/status are now protected against other users ๐Ÿ”’ this makes it impossible to learn whether any user is running a specific program โ€” well, as long as that program doesn't betray itself by its behavior ๐Ÿ™ˆ
    • 2 โ€” same as mode 1, but on top of that the /proc/pid directories belonging to other users become completely invisible ๐Ÿ’€ so /proc/pid entries can no longer be used to discover the PIDs on the system. heads up though: this doesn't hide the fact that a process with a specific PID value exists โ€” that can be learned by other means, for example by "kill -0 $PID" โ€” but it does hide a process's UID and GID, which you could otherwise learn by using stat(2) on a /proc/pid directory. this greatly complicates an attacker's job of gathering info about running processes (like: discovering whether some daemon is running with elevated privileges, whether another user is running some sensitive program, whether other users are running any program at all, etc.). iconique security behavior ๐Ÿ‘‘
    • gid=gid (since Linux 3.3) โ€” specifies the ID of a group whose members are authorized to learn process information that would otherwise be prohibited by hidepid (i.e., users in this group behave as though /proc was mounted with hidepid=0). this group should be used instead of approaches like putting nonroot users into the sudoers(5) file. cleaner, safer, slay.
  • subset=pid (since Linux 5.8) โ€” show only the specified subset of procfs, hiding all the top level files and directories in procfs that aren't related to tasks ๐ŸŒˆ

๐Ÿ’– FILES ๐Ÿ’–

underneath /proc, there are these general groups of files and subdirectories:

/proc/pid subdirectories

see proc_pid(5) โœจ

each one of these subdirectories contains files and subdirectories exposing information about the process with the corresponding process ID.

underneath each of the /proc/pid directories, there's a task subdirectory that contains subdirectories of the form task/tid, which contain corresponding information about each of the threads in the process, where tid is the kernel thread ID of the thread ๐Ÿงต

the /proc/pid subdirectories are visible when iterating through /proc with getdents(2) (and thus they're visible when you use ls(1) to view the contents of /proc).

/proc/tid subdirectories

see proc_tid(5) โœจ

each one of these subdirectories contains files and subdirectories exposing information about the thread with the corresponding thread ID. the contents of these directories are the same as the corresponding /proc/pid/task/tid directories.

the /proc/tid subdirectories are not visible when iterating through /proc with getdents(2) (and thus they're not visible when you use ls(1) to view the contents of /proc). sneaky ๐Ÿ™ˆ

/proc/self

see proc_self(5) โœจ

when a process accesses this magic symbolic link, it resolves to the process's own /proc/pid directory. it's giving "who am i, really" ๐Ÿชž

/proc/thread-self

see proc_thread-self(5) โœจ

when a thread accesses this magic symbolic link, it resolves to the process's own /proc/self/task/tid directory.

/proc/[a-z]*

various other files and subdirectories under /proc expose system-wide information ๐Ÿ‘‘

see also:


๐Ÿงš NOTES ๐Ÿงš

ngl, a lot of these files contain strings (like the environment and the command line) that are in the internal format, with subfields terminated by null bytes ('\0') ๐Ÿ˜ญ so when you're inspecting such files, you might find the results are way more readable if you use a command of this form to display them:

$ cat file | tr '\000' '\n'

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

the Linux kernel source files: Documentation/filesystems/proc.rst, Documentation/admin-guide/sysctl/fs.rst, Documentation/admin-guide/sysctl/kernel.rst, Documentation/admin-guide/sysctl/net.rst, and Documentation/admin-guide/sysctl/vm.rst.


aaaand that's the whole page bestie ๐Ÿ’– this one came from Linux man-pages 6.20, dated 2026-09-09 โ€” go forth and ls /proc responsibly, 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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms