VMware ESXi and vSphere Cluster Management

Linux proc Filesystem (procfs): System and Process Information

Learn how Linux procfs works, explore /proc system and process information, and safely inspect CPU, memory, filesystems, kernel, and process details.

procfs, usually mounted at /proc, is a Linux virtual filesystem for viewing live information supplied by the kernel. It exposes details about processes, memory, CPUs, supported filesystems, kernel state, and other system resources.

Unlike a conventional filesystem, procfs is not primarily a collection of persistent files stored on a disk. Its entries are generated dynamically. Because they represent current system state, contents can change while you inspect them: a process can exit, memory values can change, and new processes can appear.

What Is procfs?

The Linux kernel is the core part of the operating system. It manages hardware, processes, memory, and many low-level resources. procfs is a kernel-provided interface that presents selected parts of that state in a filesystem-like form.

On a typical Linux installation, procfs is mounted at /proc. You can read many entries using familiar tools such as cat and less, but procfs entries do not necessarily behave exactly like ordinary files. Reading an entry asks the kernel for information, and some entries can also act as control interfaces when written to.

Organization of the /proc Hierarchy

The top level of /proc contains two broad categories:

  • System-wide entries: Files and directories directly under /proc describe the running system, kernel, hardware, or global resources.
  • Per-process directories: A directory whose name is a number represents a process ID, or PID. For example, /proc/1234 describes the process currently having PID 1234.

Procfs can also expose kernel-managed execution contexts, including entries associated with kernel threads. The exact hierarchy varies with the kernel version, Linux distribution, CPU architecture, enabled kernel features, namespaces, procfs mount options, and permissions.

ls /proc

PID 1 is a useful navigation example:

ls /proc/1
cat /proc/1/status

On a normal host, PID 1 is commonly the system's first userspace process. Inside a container or another PID namespace, PID 1 has a different namespace-local identity and may be a container init process. Therefore, the meaning of /proc/1 depends on the environment in which the command runs.

Inspecting procfs Safely

Use read-oriented tools to examine procfs:

cat /proc/version
less /proc/meminfo
cat /proc/filesystems

For long output, filtering is useful. grep selects matching lines, while tools such as column can improve the presentation of whitespace-separated data when appropriate.

grep -E 'MemTotal|MemAvailable|MemFree|Buffers|Cached|SwapTotal|SwapFree' /proc/meminfo
grep -E '^(processor|model name|Hardware|Features|flags)' /proc/cpuinfo

A procfs path may become invalid between the time you list it and the time you read it. This is especially common with /proc/PID: the process may terminate, and its PID may later be reused by another process.

CPU Information: /proc/cpuinfo

/proc/cpuinfo reports processor-related information from the running kernel. On many systems, it contains a record for each logical processor. Typical fields include:

  • processor: a logical processor number, where provided.
  • Model or hardware identification fields, such as model name or Hardware.
  • Architecture-dependent capability fields, such as flags or Features.
  • CPU feature flags that indicate instruction sets and other processor capabilities.
cat /proc/cpuinfo
grep -E '^(processor|model name|Hardware|Features|flags)' /proc/cpuinfo

The exact field names and layout depend on the CPU architecture and kernel. A parser that assumes x86-only fields such as model name or flags may fail on ARM and other architectures. Inspect the complete file when portability matters.

Supported Filesystem Types: /proc/filesystems

/proc/filesystems lists filesystem implementations known to the running kernel.

cat /proc/filesystems

Some lines begin with nodev. This marker means that the filesystem type does not require a block device. Such filesystems are often kernel-managed or memory-based, although the marker describes device requirements rather than whether the filesystem is currently active.

EntryInterpretation
nodev procThe proc filesystem does not require a block device.
ext4 or another unmarked typeThe kernel knows a filesystem implementation commonly associated with a block device.

A filesystem listed here is kernel-supported, not necessarily mounted. Use separate mount information when you need to discover currently mounted filesystems.

Memory Information: /proc/meminfo

/proc/meminfo provides memory-accounting statistics. Values are commonly reported in kilobytes, although the precise accounting model and available fields depend on the kernel.

cat /proc/meminfo
grep -E 'MemTotal|MemAvailable|MemFree|Buffers|Cached|SwapTotal|SwapFree' /proc/meminfo
FieldMeaningHow to use itCommon misinterpretation to avoid
MemTotalTotal physical memory recognized by the kernel.Establish the host's available RAM capacity.It is not the amount currently unused.
MemFreeMemory not currently used by the kernel for any purpose.Use as one component of memory analysis.Low MemFree alone does not prove memory exhaustion.
MemAvailableAn estimate of memory usable by applications without substantial swapping.Use as a better initial indicator of immediately available memory.It is an estimate, not a guaranteed allocation.
BuffersMemory used for certain kernel block-device buffers.Review alongside other reclaimable memory figures.Do not add fields blindly; accounting categories can overlap or differ by kernel.
CachedMemory used for filesystem cache.Assess how much RAM may be reclaimable under pressure.Cached memory is not automatically wasted memory.
SwapTotalTotal configured swap space known to the kernel.Check whether swap is available.Configured swap does not mean the system is actively swapping.
SwapFreeSwap space that is currently unused.Compare with SwapTotal and workload behavior.Low SwapFree alone does not describe current performance or pressure.

Linux deliberately uses otherwise available RAM for caching. Consequently, MemFree may be small even when applications can obtain memory. Start with MemAvailable, then consider Cached, Buffers, swap values, and actual workload behavior.

Kernel and Operating-System Details: /proc/version

/proc/version displays kernel release and build-related information. Its output may include the compiler, build metadata, and distribution-specific text.

cat /proc/version

This is useful for identifying the running kernel and noticing build differences. It is not a stable interface for identifying the Linux distribution release. Distribution identity is commonly reported by other release-information files or tools, while /proc/version primarily describes the kernel build.

Per-Process Directories: /proc/PID

Each active process can be inspected through a directory named for its PID:

ls /proc/<PID>

The directory appears when a process starts and normally disappears when it exits. Process visibility and access are not universal. Ownership, security policies, containers, PID namespaces, and procfs mount options can restrict what a user sees or reads.

In a PID namespace, /proc is normally presented according to the processes visible in that namespace. A container may therefore show only a subset of host processes, and its PID numbers may differ from the corresponding host PIDs.

Key Files in /proc/PID

Path patternContentsFormatting or access considerationsExample diagnostic use
/proc/PID/cmdlineThe command-line arguments used to start the process.Arguments are separated by NUL bytes, not ordinary spaces or newlines. Access can be restricted.Confirm the executable and startup arguments.
/proc/PID/environThe process's environment variables.Values use NUL separators and may contain credentials, tokens, or confidential configuration. Read only when authorized.Diagnose configuration inherited at process startup.
/proc/PID/statusA human-readable summary of identity, state, memory, threads, capabilities, and related attributes.Readable text, but fields can vary by kernel and access may be restricted.Check process state, user IDs, thread count, memory indicators, and capabilities.

Reading cmdline

tr '\0' '\n' < /proc/<PID>/cmdline

The tr command converts each NUL separator into a newline so that arguments are easier to read. Do not assume the result is a complete or permanent description of a process: startup data can be unusual, and the process can exit during inspection.

Reading status

cat /proc/<PID>/status

The status file is generally easier to read than the raw interfaces. It can show the process name, state, identifiers, memory-related fields, number of threads, and capability information. Validate the process identity before using a PID's data, especially in scripts or long-running investigations.

Reading environ Carefully

tr '\0' '\n' < /proc/<PID>/environ

Environment variables are sensitive. They may contain passwords, API keys, session tokens, connection strings, or private configuration. Inspect another user's environment only when authorized, avoid copying it into logs or tickets, and do not share values that expose secrets.

Permissions, Security, and Namespaces

  • Procfs visibility is not guaranteed for every user or process.
  • Security settings and procfs mount options can hide or restrict process information.
  • Container boundaries and PID namespaces can limit the process list visible through /proc.
  • Reading process data belonging to another user may require administrative privileges and explicit authorization.
  • Elevated privileges do not make handling secrets safe by default; protect any data obtained from environ or similar entries.

Practical Inspection Workflow

Inspect system-wide information

  1. Read the relevant procfs entry with cat or less.
  2. Filter long output with grep when you know the fields you need.
  3. Interpret the result as a snapshot of live kernel state, not a permanent disk file.
cat /proc/cpuinfo
cat /proc/filesystems
cat /proc/meminfo
cat /proc/version

Inspect a running process

  1. Choose an existing PID, such as 1, or obtain one from a process-listing tool.
  2. Confirm that the PID still exists.
  3. Read status to identify the process and review its state.
  4. Read cmdline with NUL conversion if startup arguments are needed.
  5. Read environ only for an authorized process and handle the output as sensitive.
ls /proc/<PID>
cat /proc/<PID>/status
tr '\0' '\n' < /proc/<PID>/cmdline

Troubleshooting procfs Inspection

Permission denied

If reading /proc/PID/environ or another process entry returns Permission denied, the process may belong to another user, a security policy may be active, or the process may not be visible in the current container or PID namespace. Confirm ownership and authorization. Use administrative privileges only when permitted, and do not bypass security controls merely to inspect sensitive data.

A process directory disappears

The target process may have exited, or the PID may have been reused. Recheck the PID, collect information promptly, and use status to validate the process identity before relying on the result.

cmdline or environ looks malformed

These entries use NUL separators, so ordinary terminal output can appear as one continuous string or contain unusual characters. Convert NUL bytes with tr. Empty or minimal output may reflect how the process was started or how its startup data is represented.

MemFree is low

Linux may be using RAM for filesystem cache and buffers. Review MemAvailable, Cached, and Buffers, then assess swap activity and workload behavior. Do not diagnose memory shortage from MemFree alone.

Expected CPU fields are missing

CPU fields are architecture-specific. Inspect the complete /proc/cpuinfo file and adapt scripts to fields such as Hardware or Features when appropriate instead of assuming x86 naming.

A filesystem is listed but not mounted

/proc/filesystems describes filesystem implementations supported by the kernel. It does not describe current mount state. Use separate mount information when the question is which filesystems are mounted now.

Exam-Relevant Notes

  • procfs is virtual: Its entries are supplied dynamically by the kernel rather than stored as ordinary persistent files.
  • /proc/PID means a process directory: The numeric name is a process identifier.
  • MemAvailable matters: Low MemFree does not necessarily indicate memory exhaustion because cache can be reclaimed.
  • nodev is not “currently mounted”: It indicates that a filesystem type does not require a block device.
  • NUL separators matter: cmdline and environ require special formatting for readable terminal output.
  • Namespace context matters: A container's /proc may show a different process view from the host.

For a concise reference, see Linux proc filesystem (procfs).