Sobes.tech
Junior

What is contained in the Linux directory: /proc?

sobes.tech AI

Answer from AI

Information about running processes, the kernel, and system resources. This is a virtual file system in RAM.

Main subdirectories and files:

  • /proc/<PID>: Information about the process with the identifier PID. Contents include:
    • cmdline: Command line arguments of the process.
    • environ: Environment variables of the process.
    • fd: Links to open streams (file descriptors).
    • status: Process status (name, user ID, group, memory consumption, etc.).
  • /proc/cpuinfo: CPU information.
  • /proc/meminfo: Memory usage information.
  • /proc/filesystems: List of supported file systems.
  • /proc/interrupts: Interrupt information.
  • /proc/mounts: List of mounted file systems.
  • /proc/net: Network subsystem information.
  • /proc/self: Symbolic link to the current process's directory.
  • /proc/sys: Kernel parameters available for modification.

Example of obtaining memory information:

# Display memory information
cat /proc/meminfo

Example of getting the PID of a process by name:

# Get the PID of the 'systemd' process
pgrep systemd

Then you can view information about this process:

# Get the command line of the process with a specific PID
cat /proc/<PID>/cmdline