Hardware Probing Using Linux

This topic was published by and viewed 2746 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author
    Posts

  • DevynCJohnson
    Keymaster
    • Topics - 437
    • @devyncjohnson

    When using Linux, there are a variety of ways users can figure out what hardware is present and get various details about the hardware and system. This may be important to test which hardware was properly recognized and working or to assess the usefulness of a computer. In addition, this information helps Linux users know their hardware when compiling a kernel specifically tuned for their system. Also, the admin may need to gather information about the Linux system. Some Linux systems may not have certain commands and utilities installed, so multiple methods of getting this information will be provided.

    CPU

    To view information about the CPU, type lscpu.

    lscpu
    lscpu

    If that method fails, or if more information is needed, then type cat /proc/cpuinfo.

    /proc/cpuinfo
    /proc/cpuinfo

    Disk Space

    The "df" command provides information on the storage usage. Each filesystem is listed with the total, used, and free space. Using the "-a" parameter lists additional filesystems (the psuedo-filesystems).

    df
    df
    df -a
    df -a

    The "du" command prints a detailed list of the space usage for each directory and sub-directory.

    If RAID is present, then cat /proc/mdstat displays information regarding the RAID devices.

    Filesystems

    "cat /proc/filesystems" displays the filesystems that are supported by the active Linux kernel. To see which filesystems are currently mounted, type "cat /proc/mounts" or "mount".

    Information concerning the partitions is displayed by executing "cat /proc/partitions".

    Partition information can be viewed by executing fdisk -l with Root privileges.

    Hardware

    For an extensive list of hardware information, execute the "lshw" command. This command runs better with Root privileges and provides additional information that is more accurate than running the command without Root privileges.

    To view the list of configured and supported block and character devices that are currently usable on the system, type cat /proc/devices.

    Kernel

    To view the list of loaded modules running with the currently active Linux kernel, type "cat /proc/modules". The first column is the module's name and the second column is the memory usage of the module in bytes. Next, in the third column, the number of module instances running is shown. A "0" indicates that the module was unloaded. Next, the modules dependencies are listed. Afterwards, the module's current state is listed. Lastly, the sixth column shows the first memory address of the module.

    Alternatively, to list currently loaded kernel modules, execute lsmod in a command-line.

    Memory

    Many computer users may need information concerning their computer's memory. Running cat /proc/meminfo or less /proc/meminfo provides a lot of information about the system's memory. Also, this method works on most Linux systems.

    less /proc/meminfo
    less /proc/meminfo

    Another method is to run "free" which displays the amount of memory that is free and used compared to the total.

    free
    free

    "vmstat" is another tool that provides information about the memory.

    vmstat
    vmstat

    The user can see how the memory is allocated for each physical device by typing cat /proc/iomem. The first column shows the memory register and the next column shows what device is using that register range.

    /proc/iomem
    /proc/iomem

    For information about the memory at the "slab level", type cat /proc/slabinfo. As an alternative, type "slabtop". A slab is a single set of memory that is not fragmented. This means that the set of memory is contiguous and dedicated to a particular resource or object.

    cat /proc/swaps provides information about the system's swap space (if swap space exists).

    Network

    The "ifconfig" command lists the various network devices, their mac address, and various other information. An alternative command is "ip address show".

    ifconfig
    ifconfig

    Type "hostname" to view the system's hostname. As an alternative, type cat /proc/sys/kernel/hostname.

    PCI

    The "lspci" command is similar to the "lsusb" command, but this is for information about the PCI devices. Type lspci -tv to get additional PCI information. If "lspci" fails, try "cat /proc/pci".

    lspci
    lspci
    lspci -t
    lspci -t

    Ports

    The I/O ports can be viewed with cat /proc/ioports which displays the port address and the device that is using that address or address range.

    System

    Various system statistics stored in /proc/ cna be displayed using "procinfo".

    For information about the system in general, type "uname -a" to see the system's kernel version, distro type, etc. To view the kernel version, type "uname -r".

    uname
    uname

    As an alternative, "lsb_release -a" displays some of the same information. As an additional alternative, type cat /proc/version.

    lsb_release
    lsb_release

    cat /proc/crypto lists all of the cryptographic ciphers that the active Linux kernel supports. Also, some information regarding each cipher is provided.

    To see the parameters that were given to the kernel during boot-time, type cat /proc/cmdline. These parameters were likely given to the kernel by GRUB or some other bootloader.

    To see how long the system has been on, type "uptime". As an alternative, type "cat /proc/uptime". The first column is the system's uptime in seconds and the second column is the idle time in seconds.

    Various hardware and BIOS information can be gathered using the "dmidecode" command. To use the command, type dmidecode -t X, where "X" is a number indicating the information category. The various categories recognized by dmidecode are listed below.

    • 0 BIOS
    • 1 System
    • 2 Base Board
    • 3 Chassis
    • 4 Processor
    • 5 Memory Controller
    • 6 Memory Module
    • 7 Cache
    • 8 Port Connector
    • 9 System Slots
    • 10 On Board Devices
    • 11 OEM Strings
    • 12 System Configuration Options
    • 13 BIOS Language
    • 14 Group Associations
    • 15 System Event Log
    • 16 Physical Memory Array
    • 17 Memory Device
    • 18 32-bit Memory Error
    • 19 Memory Array Mapped Address
    • 20 Memory Device Mapped Address
    • 21 Built-in Pointing Device
    • 22 Portable Battery
    • 23 System Reset
    • 24 Hardware Security
    • 25 System Power Controls
    • 26 Voltage Probe
    • 27 Cooling Device
    • 28 Temperature Probe
    • 29 Electrical Current Probe
    • 30 Out-of-band Remote Access
    • 31 Boot Integrity Services
    • 32 System Boot
    • 33 64-bit Memory Error
    • 34 Management Device
    • 35 Management Device Component
    • 36 Management Device Threshold Data
    • 37 Memory Channel
    • 38 IPMI Device
    • 39 Power Supply

    USB

    The lsusb command displays various USB information. Typing "lsusb -tv" displays the detected USB devices in a tree format with additional information.

    lsusb -t
    lsusb -t

    Other

    To list SCSI devices, type lsscsi.

    To list Firewire devices, type lspci | grep -E -i "(1394|firewire)".

    Information about various devices detected at boot-time can be found using "dmesg" with "grep" such as dmesg | grep -i tty.

    Information concerning block devices can be viewed using lsblk.

    Further Reading

    Attachments:
    1. df
    2. df -a
    3. free
    4. ifconfig
    5. less /proc/meminfo
    6. lsb_release
    7. lscpu
    8. lspci
    9. lspci -t
    10. lsusb -t
    11. /proc/cpuinfo
    12. /proc/iomem
    13. uname
    14. vmstat
Viewing 1 post (of 1 total)