DEV Community

Vivek P
Vivek P

Posted on

Linux System Information Files Reference

Linux System Information Files Reference

This guide provides an overview of important system information files in Linux, typically found in the /proc and /sys filesystems. These files offer valuable insights into the system's current state and configuration.

1. /proc/ioports

Purpose: Shows registered I/O port regions and their usage by devices or drivers.

Example content:

0000-0cf7 : PCI Bus 0000:00
  0000-001f : dma1
  0020-0021 : pic1
  0040-0043 : timer0
  ...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/ioports

2. /proc/interrupts

Purpose: Displays information about system interrupts, including which are in use and by which devices.

Example content:

           CPU0       
  0:         36   IO-APIC-edge      timer
  1:          9   IO-APIC-edge      i8042
  ...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/interrupts

3. /proc/meminfo

Purpose: Provides detailed information about system memory usage.

Example content:

MemTotal:        8174824 kB
MemFree:         3975548 kB
MemAvailable:    5631104 kB
...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/meminfo

4. /proc/cpuinfo

Purpose: Contains detailed information about the system's CPU(s).

Example content:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 142
model name      : Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/cpuinfo

5. /proc/devices

Purpose: Lists all character and block devices currently configured in the kernel.

Example content:

Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  ...
Block devices:
  7 loop
  8 sd
 11 sr
...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/devices

6. /proc/modules

Purpose: Lists all currently loaded kernel modules.

Example content:

snd_hda_codec_hdmi 49152 1 - Live 0x0000000000000000
snd_hda_codec_realtek 106496 1 - Live 0x0000000000000000
...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/modules

7. /proc/version

Purpose: Shows the Linux kernel version and additional system information.

Example content:

Linux version 5.4.0-42-generic (buildd@lcy01-amd64-027) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/version

8. /proc/partitions

Purpose: Lists all partitions known to the system.

Example content:

major minor  #blocks  name
   8        0  976762584 sda
   8        1     524288 sda1
   8        2  976236544 sda2
 ...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/partitions

9. /proc/mounts

Purpose: Shows currently mounted filesystems.

Example content:

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
...
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/mounts

10. /proc/net/dev

Purpose: Provides statistics about network interfaces.

Example content:

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo: 2816326   34851    0    0    0     0          0         0  2816326   34851    0    0    0     0       0          0
  eth0: 1215332    2535    0    0    0     0          0        19   187816    1353    0    0    0     0       0          0
Enter fullscreen mode Exit fullscreen mode

Usage: cat /proc/net/dev

11. /sys/class/net

Purpose: Contains directories for each network interface, providing detailed information and controls.

Example usage:

ls /sys/class/net                     # List network interfaces
cat /sys/class/net/eth0/address       # Show MAC address of eth0
cat /sys/class/net/eth0/statistics/rx_bytes  # Show received bytes on eth0
Enter fullscreen mode Exit fullscreen mode

12. /proc/uptime

Purpose: Shows how long the system has been running.

Example content:

350735.47 1395914.78
Enter fullscreen mode Exit fullscreen mode

(The first number is total uptime in seconds, the second is idle time)

Usage: cat /proc/uptime

Additional Notes

  • These files are part of the procfs (process filesystem) and sysfs in Linux.
  • They provide real-time information about the system's current state.
  • The content of these files is generated on-the-fly when read.
  • Some files may require root privileges to access, depending on system configuration.
  • The /sys filesystem (sysfs) provides a more structured way to access kernel information and manipulate device parameters.

Remember to use these files responsibly, especially in production environments, as reading them can impact system performance if done excessively.

Top comments (0)