|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
5.2. Top-level Files in the proc File SystemBelow is a list of some of the more useful virtual files in the top-level of the /proc/ directory.
5.2.1. /proc/apmThis file provides information about the state of the Advanced Power Management (APM) system and is used by the apm command. If a system with no battery is connected to an AC power source, this virtual file would look 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:
5.2.2. /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 tells us that the kernel is mounted read-only (signified by (ro)) off of the second partition on the first IDE device (/dev/hda2). 5.2.3. /proc/cpuinfoThis virtual file identifies the type of processor used by your system. The following is an example of the output typical of /proc/cpuinfo:
5.2.4. /proc/devicesThis file displays the various character and block devices currently configured (not include devices whose modules are not loaded). Below is a sample output from this 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:
For more information about devices see /usr/src/linux-2.4/Documentation/devices.txt. 5.2.5. /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:
5.2.6. /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. 5.2.7. /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:
5.2.8. /proc/filesystemsThis file displays a list of the file system types currently supported by the kernel. Sample output from a generic /proc/filesystems 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 names of the file systems supported. The mount command cycles through these file systems listed here when one is not specified as an argument. 5.2.9. /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:
5.2.10. /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 lists the kind of memory located within those registers. In particular, this column displays which memory registers are used by the kernel within the system RAM or, if the network interface card has multiple Ethernet ports, the memory registers assigned for each port. 5.2.11. /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 I/O port address range reserved for the device listed in the second column. 5.2.12. /proc/isapnpThis file lists installed 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 a 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. 5.2.13. /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 the 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.
5.2.14. /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. 5.2.15. /proc/ksymsThis file contains the symbol definitions used by the module tools to dynamically link and bind kernel 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. 5.2.16. /proc/loadavgThis file provides a look at load average on the processor over time, as well as 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. 5.2.17. /proc/locksThis file displays the files currently locked by the kernel. The contents of this file contain 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 or MANDATORY. 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. 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. 5.2.18. /proc/mdstatThis file contains the current information for multiple-disk, RAID configurations. If your system does not contain such a configuration, then /proc/mdstat will look similar to this:
This file remains in the same state as seen above unless a software RAID or md device is present. In that case, view /proc/mdstat to view the current status of mdX RAID devices. The /proc/mdstat file below shows a system with its md0 configured as a RAID 1 device, while it is currently re-syncing the disks:
5.2.19. /proc/meminfoThis is one of the more commonly used files in the /proc/ directory, as it reports a large amount of valuable information about the systems RAM usage. The following sample /proc/meminfo virtual file is from a system with 256MB of RAM and 384MB of swap space:
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:
5.2.20. /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, while the second column shows the driver in use. 5.2.21. /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 lists 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). A module with a line containing a name listed in brackets ([ or ]) indicates that the module depends upon another module to be present in order to function. 5.2.22. /proc/mountsThis file provides a list of all mounts used by the system:
The output found here is similar to contents of /etc/mtab, except that /proc/mount is more up-to-date. The first column specifies the device that is mounted, the second column revealing the mountpoint, and 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. 5.2.23. /proc/mtrrThis file refers to the current Memory Type Range Registers (MTRRs) in use with the system. If the system architecture supports MTRRs, then the /proc/mtrr file may look similar to this:
MTRRs are used with the Intel P6 family of processors (Pentium II and higher), and they 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 by default. More information on manually configuring this file, can be found online at the following URL: http://web1.linuxhq.com/kernel/v2.3/doc/mtrr.txt.html. 5.2.24. /proc/partitionsMost of the information here is of little importance to the user, except for the following columns:
5.2.25. /proc/pciThis file contains a full listing of every PCI device on the system. Depending on the number of PCI devices, /proc/pci can be 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 detailed IRQ information so an administrator can quickly look for conflicts.
5.2.26. /proc/slabinfoThis file gives information about memory usage on the slab level. Linux kernels greater than version 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. 5.2.27. /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:
5.2.28. /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 file name, the 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. 5.2.29. /proc/uptimeThis file contains information detailing how long the system has been on since its last restart. The output of /proc/uptime is quite minimal:
The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds. 5.2.30. /proc/versionThis file specifies the version of the Linux kernel and gcc in use, 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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||