-proc -[0-9]+-status

The /proc/[PID]/status file in Linux provides detailed information about a process, where [PID] is the process ID of a running process. It contains various fields that describe the status of the process, such as memory usage, state, and other statistics.

Here's a breakdown of the contents and some of the common fields you will find in the /proc/[PID]/status file:

Common Fields in /proc/[PID]/status

  1. Name

    • The name of the process.

    • Example: Name: bash

  2. Pid

    • The Process ID (PID) of the process.

    • Example: Pid: 1234

  3. PPid

    • The Parent Process ID (PPID), which is the PID of the process that started this process.

    • Example: PPid: 5678

  4. Uid

    • User ID (UID) of the process owner.

    • Example: Uid: 1000 1000 1000 1000

  5. Gid

    • Group ID (GID) of the process.

    • Example: Gid: 1000 1000 1000 1000

  6. VmSize

    • The total virtual memory size of the process in kilobytes.

    • Example: VmSize: 10240 kB

  7. VmRSS

    • The resident set size (RSS), which is the non-swapped physical memory the process uses, in kilobytes.

    • Example: VmRSS: 2048 kB

  8. State

    • The state of the process. This can be one of the following:

      • R: Running

      • S: Sleeping

      • D: Waiting for I/O

      • Z: Zombie

      • T: Stopped

      • W: Paging

    • Example: State: S (sleeping)

  9. Tgid

    • Thread Group ID. For multithreaded processes, this is the PID of the first thread.

    • Example: Tgid: 1234

  10. Threads

    • The number of threads currently being used by the process.

    • Example: Threads: 2

  11. TracerPid

    • The PID of the process tracing this one (if any).

    • Example: TracerPid: 0

  12. FDSize

    • The number of file descriptors the process has opened.

    • Example: FDSize: 64

  13. SigQ

    • The number of pending signals for the process.

    • Example: SigQ: 0/123

  14. CapInh

    • Inherited capabilities for the process.

    • Example: CapInh: 00000000

  15. CapPrm

    • Effective capabilities for the process.

    • Example: CapPrm: 00000000

  16. CapEff

    • The process’s current capabilities.

    • Example: CapEff: 00000000

  17. Seccomp

    • The process's seccomp filter mode.

    • Example: Seccomp: 0

  18. Cpus_allowed

    • A bitmask of CPUs on which the process can run.

    • Example: Cpus_allowed: 00000001

  19. Cpus_allowed_list

    • A more readable format of CPUs allowed.

    • Example: Cpus_allowed_list: 0

  20. Mems_allowed

    • A bitmask of memory nodes that the process can use.

    • Example: Mems_allowed: 00000001

Example of /proc/[PID]/status

Name:   bash
Pid:    1234
PPid:   5678
Uid:    1000    1000    1000    1000
Gid:    1000    1000    1000    1000
State:  S (sleeping)
VmSize: 10240 kB
VmRSS:  2048 kB
Threads:        2
FDSize: 64
SigQ:   0/123
CapInh: 00000000
CapPrm: 00000000
CapEff: 00000000
Seccomp:        0
Cpus_allowed:   00000001
Cpus_allowed_list:       0
Mems_allowed:   00000001

Usage

You can use a regular expression like -proc -[0-9]+-status to find and parse the status files for processes, where:

  • /proc/[PID]/status contains the status information of the process with ID PID.

  • The [0-9]+ part of the regular expression will match any process ID, so it can be used to find all status files in the /proc directory.

For example, to view the status of a process with PID 1234:

cat /proc/1234/status

This gives a comprehensive snapshot of the process, useful for monitoring system performance, debugging, or gaining insight into process behavior.

Last updated