7.4 Kernel Information

Many of the entries in /proc provide access to information about the running kernel's configuration and state. Some of these entries are at the top level of /proc; others are under /proc/sys/kernel.

7.4.1 Version Information

The file /proc/version contains a long string describing the kernel's release number and build version. It also includes information about how the kernel was built: the user who compiled it, the machine on which it was compiled, the date it was compiled, and the compiler release that was used—for example:

% cat /proc/version 
Linux version 2.2.14-5.0 (root@porky.devel.redhat.com) (gcc version 
egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)) #1 Tue Mar 7 
21:07:39 EST 2000 

This indicates that the system is running a 2.2.14 release of the Linux kernel, which was compiled with EGCS release 1.1.2. (EGCS, the Experimental GNU Compiler System, was a precursor to the current GCC project.)

The most important items in this output, the OS name and kernel version and revision, are available in separate /proc entries as well. These are /proc/sys/kernel/ostype, /proc/sys/kernel/osrelease, and /proc/sys/kernel/version, respectively.

% cat /proc/sys/kernel/ostype 
% cat /proc/sys/kernel/osrelease 
% cat /proc/sys/kernel/version 
#1 Tue Mar 7 21:07:39 EST 2000 

7.4.2 Hostname and Domain Name

The /proc/sys/kernel/hostname and /proc/sys/kernel/domainname entries contain the computer's hostname and domain name, respectively. This information is the same as that returned by the uname system call, described in Section 8.15.

7.4.3 Memory Usage

The /proc/meminfo entry contains information about the system's memory usage. Information is presented both for physical memory and for swap space. The first three lines present memory totals, in bytes; subsequent lines summarize this information in kilobytes—for example:

% cat /proc/meminfo 
        total:    used:    free:  shared: buffers:  cached: 
Mem:  529694720 519610368 10084352 82612224 10977280 82108416 
Swap: 271392768 44003328 227389440 
MemTotal:    517280 kB 
MemFree:       9848 kB 
MemShared:    80676 kB 
Buffers:      10720 kB 
Cached:       80184 kB 
BigTotal:         0 kB 
BigFree:          0 kB 
SwapTotal:   265032 kB 
SwapFree:    222060 kB 

This shows 512MB physical memory, of which about 9MB is free, and 258MB of swap space, of which 216MB is free. In the row corresponding to physical memory, three other values are presented:

·         The Shared column displays total shared memory currently allocated on the system (see Section 5.1, "Shared Memory" ).

·         The Buffers column displays the memory allocated by Linux for block device buffers. These buffers are used by device drivers to hold blocks of data being read from and written to disk.

·         The Cached column displays the memory allocated by Linux to the page cache. This memory is used to cache accesses to mapped files.

You can use the free command to display the same memory information.