proc(5)

NAME
proc - process information, system information, and sysctl pseudo-filesystem

DESCRIPTION
The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structures. It is commonly mounted at /proc. Typically, it is mounted automatically by the system, but it can also be mounted manually using a command such as:

    mount -t proc proc /proc

Most of the files in the proc filesystem are read-only, but some files are writable, allowing kernel variables to be changed.

  Mount options
The proc filesystem supports the following mount options:

hidepid=n (since Linux 3.3)
    This option controls who can access the information in /proc/pid directories. The argument, n, is one of the following values:

    0   Everybody may access all /proc/pid directories. This is the traditional behavior, and the default if this mount option is not specified.

    1   Users may not access files and subdirectories inside any /proc/pid directories but their own (the /proc/pid directories themselves remain visible). Sensitive files such as /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 (so long as the program doesn't otherwise reveal itself by its behavior).

    2   As for mode 1, but in addition the /proc/pid directories belonging to other users become invisible. This means that /proc/pid entries can no longer be used to discover the PIDs on the system. This doesn't hide the fact that a process with a specific PID value exists (it can be learned by other means, for example, by "kill -0 $PID"), but it hides a process's UID and GID, which could otherwise be learned by employing stat(2) on a /proc/pid directory. This greatly complicates an attacker's task of gathering information about running processes (e.g., 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, and so on).

    gid=gid (since Linux 3.3)
        Specifies the ID of a group whose members are authorized to learn process information otherwise 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 such as putting nonroot users into the sudoers(5) file.

subset=pid (since Linux 5.8)
    Show only the specified subset of procfs, hiding all top level files and directories in the procfs that are not related to tasks.

  Overview
Underneath /proc, there are the following 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, a task subdirectory 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 are visible when one uses 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 are not visible when one uses ls(1) to view the contents of /proc).

/proc/self
    See proc_self(5).

    When a process accesses this magic symbolic link, it resolves to the process's own /proc/pid directory.

/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:

    proc_apm(5)
    proc_buddyinfo(5)
    proc_bus(5)
    proc_cgroups(5)
    proc_cmdline(5)
    proc_config.gz(5)
    proc_cpuinfo(5)
    proc_crypto(5)
    proc_devices(5)
    proc_diskstats(5)
    proc_dma(5)
    proc_driver(5)
    proc_execdomains(5)
    proc_fb(5)
    proc_filesystems(5)
    proc_fs(5)
    proc_ide(5)
    proc_interrupts(5)
    proc_iomem(5)
    proc_ioports(5)
    proc_kallsyms(5)
    proc_kcore(5)
    proc_key-users(5)
    proc_keys(5)
    proc_kmsg(5)
    proc_kpagecgroup(5)
    proc_kpagecount(5)
    proc_kpageflags(5)
    proc_ksyms(5)
    proc_loadavg(5)
    proc_locks(5)
    proc_malloc(5)
    proc_meminfo(5)
    proc_modules(5)
    proc_mounts(5)
    proc_mtrr(5)
    proc_net(5)
    proc_partitions(5)
    proc_pci(5)
    proc_profile(5)
    proc_scsi(5)
    proc_slabinfo(5)
    proc_stat(5)
    proc_swaps(5)
    proc_sys(5)
    proc_sysrq-trigger(5)
    proc_sysvipc(5)
    proc_timer_list(5)
    proc_timer_stats(5)
    proc_tty(5)
    proc_uptime(5)
    proc_version(5)
    proc_vmstat(5)
    proc_zoneinfo(5)

NOTES
Many files contain strings (e.g., the environment and command line) that are in the internal format, with subfields terminated by null bytes ('\0'). When inspecting such files, you may find that the results are more readable if you use a command of the following form to display them:

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

SEE ALSO
cat(1), dmesg(1), find(1), free(1), htop(1), init(1), ps(1), pstree(1), tr(1), uptime(1), chroot(2), mmap(2), readlink(2), syslog(2), slabinfo(5), sysfs(5), hier(7), namespaces(7), time(7), arp(8), hdparm(8), ifconfig(8), lsmod(8), lspci(8), mount(8), netstat(8), procinfo(8), route(8), sysctl(8)

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.