Hardware Probing Via Command-line

D

DevynCJohnson

Guest
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. 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.

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.png

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

free.png


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

vmstat.png


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.png


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).

CPU
To view information about the CPU, type "lscpu". If that method fails, or if more information is needed, then type "cat /proc/cpuinfo".

lscpu.png


proc-cpuinfo.png


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.png


df-a.png


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.

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.

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

lsusb-t.png


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

lspci.png


lspci-t.png


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".

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

ifconfig.png


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

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".

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

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.

System
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". As an alternative, "lsb_release -a" displays some of the same information. As an additional alternative, type "cat /proc/version".

uname.png


lsb_release.png


"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.

Other
To list SCSI devices, type “lsscsi”.

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

Attachments

  • slide.jpg
    slide.jpg
    34.9 KB · Views: 20,918

Staff online

Members online


Top