|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Top-level Files in the proc FilesystemBelow is a list of some of the more useful virtual files in the top-level of the /proc/ directory.
/proc/apmThis file provides information about the state of the Advanced Power Management (APM) system and is used by the apm command. If the system with no battery is connected to an AC power source, this virtual file looks similar to this:
Running the apm -v command on such a system results in output similar to this:
For systems which do not use a battery as a power source, apm is able do little more than put the machine in standby mode. The apm command is much more useful on laptops. For example, the following output is from the command cat /proc/apm on a laptop running Red Hat Linux while plugged into a power outlet:
When the same laptop is unplugged from its power source for a few minutes, the contents of the apm file change to something like this:
The apm -v command will now yield more useful data, such as the following:
/proc/cmdlineThis file shows the parameters passed to the kernel at the time it is started. A sample /proc/cmdline file looks like this:
This tell us the kernel is mounted read-only — signified by (ro) — off of the second partition on the first IDE device (/dev/hda2). /proc/cpuinfoThis virtual file identifies the type of processor used by your system. The following is an example of the output you would typically see from /proc/cpuinfo:
/proc/devicesThis file displays the various character and block devices currently configured for use with the kernel. It does not include devices whose modules are not loaded into the kernel. Below is a sample output from this virtual file:
The output from /proc/devices includes the major number and name of the device and is broken into two major sections: Character devices and Block devices. Character devices are similar to block devices, except for two basic differences. Block devices have a buffer available, allowing them to order requests before dealing with them. This is important for devices designed to store information — such as hard drives — because the ability to order the information before writing it to the device allows it to be placed in more efficient order. Character devices do not require buffering. The other difference is that block devices can send and receive information in blocks of a size configured per device. Character devices send data with no preconfigured size. For more information about devices see /usr/src/linux-2.4/Documentation/devices.txt. /proc/dmaThis file contains a list of the registered ISA direct memory access (DMA) channels in use. A sample /proc/dma files looks like this:
/proc/execdomainsThis file lists the execution domains currently supported by the Linux kernel, along with the range of personalities they support.
Think of execution domains as the "personality" for a particular operating system. Because other binary formats, such as Solaris, UnixWare, and FreeBSD, can be used with Linux, programmers can change the way the operating system treats particular system calls from these binaries by changing the personality of the task. Except for the PER_LINUX execution domain, different personalities can be implemented as dynamically loadable modules. /proc/fbThis file contains a list of frame buffer devices, with the frame buffer device number and the driver that controls it. Typical output of /proc/fb for systems which contain frame buffer devices looks similar to this:
/proc/filesystemsThis file displays a list of the file system types currently supported by the kernel. Sample output from a generic kernel's /proc/filesystems file looks similar to this:
The first column signifies whether the file system is mounted on a block device. Those beginning with nodev are not mounted on a device. The second column lists the name of the file systems supported. The mount command cycles through these file systems when one is not specified as an argument. /proc/interruptsThis file records the number of interrupts per IRQ on the x86 architecture. A standard /proc/interrupts looks similar to this:
For a multi-processor machine, this file may look slightly different:
The first column refers to the IRQ number. Each CPU in the system has its own column and its own number of interrupts per IRQ. The next column reports the type of interrupt, and the last column contains the name of the device that is located at that IRQ. Each of the types of interrupts seen in this file, which are architecture-specific, mean something a little different. For x86 machines, the following values are common:
/proc/iomemThis file shows you the current map of the system's memory for each physical device:
The first column displays the memory registers used by each of the different types of memory. The second column tells the kind of memory located within those registers. In particular, this column will tell you which memory registers are used by the kernel within the system RAM or, if you have multiple Ethernet ports on your NIC, the memory registers assigned for each port. /proc/ioportsThe output of /proc/ioports provides a list of currently registered port regions used for input or output communication with a device. This file can be quite long, with a beginning similar to this:
The first column gives the IO port address range reserved for the device listed in the second column. /proc/isapnpThis file lists Plug and Play (PnP) cards in ISA slots on the system. This is most often seen with sound cards but may include any number of devices. A /proc/isapnp file with Soundblaster entry in it looks similar to this:
This file can be quite long, depending on the number of devices displayed and their resource requirements. Each card lists its name, PnP version number, and product version number. If the device is active and configured, this file will also reveal the port and IRQ numbers for the device. In addition, to ensure better compatibility, the card will specify preferred and acceptable values for a number of different parameters. The goal here is to allow the PnP cards to work around one another and avoid IRQ and port conflicts. /proc/kcoreThis file represents the physical memory of the system and is stored in the core file format. Unlike most /proc/ files, kcore displays a size. This value is given in bytes and is equal to the size of physical memory (RAM) used plus 4KB. The contents of this file are designed to be examined by a debugger, such as gdb and is not human readable.
/proc/kmsgThis file is used to hold messages generated by the kernel. These messages are then picked up by other programs, such as /sbin/klogd. /proc/ksymsThis file holds the kernel exported symbol definitions used by the module tools to dynamically link and bind loadable modules.
The first column lists the memory address for the kernel function, the second column refers to the name of the function, and the last column reveals the name of the loaded module. /proc/loadavgThis file provides a look at load average on the processor over time and additional data used by uptime and other commands. A sample /proc/loadavg file looks similar to this:
The first three columns measure CPU utilization of the last 1, 5, and 10 minute periods. The fourth column shows the number of currently running processes and the total number of processes. The last column displays the last process ID used. /proc/locksThis files displays the files currently locked by the kernel. The content of this file contains internal kernel debugging data and can vary tremendously, depending on the use of the system. A sample /proc/locks file for a lightly loaded system looks similar to this:
Each lock has its own line which starts with a unique number. The second column refers to the class of lock used, with FLOCK signifying the older-style UNIX file locks from a flock system call and POSIX representing the newer POSIX locks from the lockf system call. The third column can have two values. ADVISORY means that the lock does not prevent other people from accessing the data; it only prevents other attempts to lock it. MANDATORY means that no other access to the data is permitted while the lock is held. The fourth column reveals whether the lock is allowing the holder READ or WRITE access to the file, and the fifth column shows the ID of the process holding the lock. The sixth column shows the ID of the file being locked, in the format of MAJOR-DEVICE:MINOR-DEVICE:INODE-NUMBER. The seventh column shows the start and end of the file's locked region. The remaining columns point to internal kernel data structures used for specialized debugging and can be ignored. /proc/mdstatThis file contains the current information for multiple-disk, RAID configurations. If your system does not contain such a configuration, then your /proc/mdstat file will look similar to this:
This file remains in the state above unless you create a software RAID or md device. In that case, you can view /proc/mdstat to give you a picture of what is currently happening with your mdX RAID devices. The /proc/mdstat file below shows a system with its md0 configured as a RAID 1 device. It is currently re-syncing the disks:
/proc/meminfoThis is one of the more commonly used files in the /proc/ directory, as it reports back plenty of valuable information about the current RAM usage on the system. A system with 256MB of RAM and 384MB of swap space will likely have a /proc/meminfo file similar to this one:
Much of the information here is used by the free, top, and ps commands. In fact, the output of the free command is even similar in appearance to the contents and structure of /proc/meminfo. But by looking directly at /proc/meminfo, more details are revealed:
/proc/miscThis file lists miscellaneous drivers registered on the miscellaneous major device, which is device number 10:
The first column is the minor number of each device, and the second column shows the driver in use. /proc/modulesThis file displays a list of all modules loaded into the kernel. Its contents will vary based on the configuration and use of your system, but it should be organized in a similar manner to this sample /proc/modules file output:
The first column contains the name of the module. The second column refers to the memory size of the module, in bytes. The third column tells you whether the module is currently loaded (1) or unloaded (0). The final column states if the module can unload itself automatically after a period without use (autoclean) or if it is not being utilized (unused). Any module with a line containing a name listed in brackets ([ or ]) tells you that this module depends upon another module to be present in order to function. /proc/mountsThis file provides a quick list of all mounts in use by the system:
The output found here is similar to contents of /etc/mtab, except that /proc/mount can be more current. The first column specifies the device that is mounted, with the second column revealing the mountpoint. The third column tells the file system type, and the fourth column tells you if it is mounted read-only (ro) or read-write (rw). The fifth and sixth columns are dummy values designed to match the format used in /etc/mtab. /proc/mtrrThis file refers to the current Memory Type Range Registers (MTRRs) in use with the system. If your system's architecture supports MTRRs, your mtrr might look something like this:
MTRRs are used with Intel P6 family of processors (Pentium II and higher), and they are used to control processor access to memory ranges. When using a video card on a PCI or AGP bus, a properly configured /proc/mtrr file can increase performance over 150%. Most of the time, this value is properly configured for you. For more information on MTRRs and manually configuring this file, please see http://web1.linuxhq.com/kernel/v2.3/doc/mtrr.txt.html. /proc/partitionsMost of the information here is of little importance to the user, except for the following columns:
/proc/pciThis file contains a full listing of every PCI device on your system. Depending on the number of PCI devices you have, /proc/pci can get rather long. An example from this file on a basic system looks similar to this:
This output shows a list of all PCI devices, sorted in the order of bus, device, and function. Beyond providing the name and version of the device, this list also gives you detailed IRQ information so you can quickly look for conflicts.
/proc/slabinfoThis file gives information about memory usage on the slab level. Linux kernels greater than 2.2 use slab pools to manage memory above the page level. Commonly used objects have their own slab pools. The following is a portion of a typical /proc/slabinfo virtual file:
The values in this file occur in the following order: cache name, number of active objects, number of total objects, size of the object, number of active slabs (blocks) of the objects, total number of slabs of the objects, and the number of pages per slab. Note that active in this case means an object is in use. Therefore an active object is one that is in use, and an active slab is one that contains one or more active object. /proc/statThis file keeps track of a variety of different statistics about the system since it was last restarted. The contents of /proc/stat, which can be quite long, begins something like this:
Some of the more popular statistics include:
/proc/swapsThis file measures swap space and its utilization. For a system with only one swap partition, the output of /proc/swap may look similar to this:
While some of this information can be found in other files in the /proc/ directory, /proc/swap provides a snapshot of every swap filename, type of swap space, the total size, and the amount of this space that is in use (in kilobytes). The priority column is useful when multiple swap files are in use. The lower the priority, the more likely the swap file is to be used. /proc/uptimeThis file contains information about how long the system has on since its last restart. The output of /proc/uptime is quite minimal:
The first number tells you the total number of seconds the system has been up. The second number tells you how much of that time the machine has spent idle in seconds. /proc/versionThis files tells you the versions of the Linux kernel and gcc, as well as the version of Red Hat Linux installed on the system:
This information is used for a variety of purposes, including the version data presented when a user logs in. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||