What does the Linux directory /proc contain?
sobes.tech AI
Answer from AI
The /proc directory in Linux is a virtual filesystem (procfs) that provides an interface to the kernel and running processes. Instead of containing real files on disk, it dynamically generates its content reflecting the system's state in real time.
Main categories of information available through /proc:
-
Process information: For each running process, a subdirectory with its PID (Process ID) as the name (e.g.,
/proc/1234) is created. Inside each such directory are files containing detailed information about the process, such as:cmdline: Command line arguments with which the process was started.cwd: Current working directory of the process.environ: Environment variables of the process.fd: Symlinks to the process's open file descriptors.status: Process status (PID, PPID, UID, GID, memory, etc.).
-
Kernel and system information:
/procalso contains files providing information about the kernel's state, settings, and system resources:cpuinfo: Information about the system's processors.meminfo: Information about memory usage.stat: Various system and process statistics.uptime: System uptime and average load.version: Kernel version.sys: A subdirectory containing dynamic kernel parameter settings (similar to/sys). It allows changing some kernel parameters at runtime.
-
Other specific files and directories: May include information about disk devices, network interfaces, filesystems, and other hardware and software components.
Examples of usage:
# View memory information
cat /proc/meminfo
# View command line arguments for process with PID 1234
cat /proc/1234/cmdline
# View kernel version
cat /proc/version