10 Linux Commands to Collect System and Hardware Information


If you're using a Linux operating system, it can be helpful to gather system and hardware information to troubleshoot any issues or simply to learn more about your system's performance. Luckily, there are plenty of built-in commands in Linux that allow you to easily collect this information.

In this article, we'll cover some of the most useful Linux commands for gathering system and hardware information, along with examples of how to use them.

uname

The uname command displays basic information about your system, including the operating system name, kernel version, and processor architecture. To use the uname command, simply open a terminal window and type −

$ uname -a

This will display all the available information about your system.

lsblk

The lsblk command lists all the available block devices on your system, including hard drives, SSDs, and USB drives. This command can be helpful if you need to determine which drives are mounted on your system. To use the lsblk command, simply open a terminal window and type −

$ lsblk

This will display a list of all the available block devices on your system.

lspci

The lspci command displays information about all the PCI buses and devices connected to your system. This command can be helpful if you need to determine which devices are installed on your system. To use the lspci command, simply open a terminal window and type −

$ lspci

This will display a list of all the PCI buses and devices connected to your system.

lsusb

The lsusb command displays information about all the USB buses and devices connected to your system. This command can be helpful if you need to determine which USB devices are installed on your system. To use the lsusb command, simply open a terminal window and type −

$ lsusb

This will display a list of all the USB buses and devices connected to your system.

Df

The df command displays information about the disk space usage on your system. This command can be helpful if you need to determine how much free space is available on your hard drive. To use the df command, simply open a terminal window and type −

$ df -h

This will display the disk space usage on your system in a human-readable format.

Free

The free command displays information about the system's memory usage. This command can be helpful if you need to determine how much free memory is available on your system. To use the free command, simply open a terminal window and type −

$ free -h

This will display the memory usage on your system in a human-readable format.

Top

The top command displays information about the system's processes, including their CPU and memory usage. This command can be helpful if you need to determine which processes are using the most resources on your system. To use the top command, simply open a terminal window and type −

$ top

This will display a list of all the processes currently running on your system, along with their CPU and memory usage.

Htop

The htop command is similar to the top command, but it provides a more user-friendly interface with colored output and the ability to sort processes by various criteria. To use the htop command, you'll first need to install it using your system's package manager. Once installed, you can open a terminal window and type −

$ htop

This will launch the htop interface, which you can use to view and manage the processes running on your system.

Dmesg

The dmesg command displays the system's boot messages, which can be helpful if you need to troubleshoot any issues that occurred during the boot process. To use the dmesg command, simply open a terminal window and type −

$ dmesg

This will display the system's boot messages, including any errors or warnings that occurred during the boot process.

lsmod

The lsmod command displays information about the kernel modules currently loaded on your system. This command can be helpful if you need to determine which modules are loaded or to troubleshoot issues related to kernel modules. To use the lsmod command, simply open a terminal window and type −

$ lsmod

This will display a list of all the kernel modules currently loaded on your system.

lshw

The lshw command displays detailed information about the hardware on your system, including CPU, memory, storage devices, and peripherals. This command can be helpful if you need to troubleshoot any hardware issues or simply to learn more about the hardware on your system. To use the lshw command, you'll first need to install it using your system's package manager. Once installed, you can open a terminal window and type −

$ sudo lshw

This will display detailed information about the hardware on your system.

Hwinfo

The hwinfo command is similar to the lshw command, but it provides even more detailed information about the hardware on your system. To use the hwinfo command, you'll first need to install it using your system's package manager. Once installed, you can open a terminal window and type −

$ sudo hwinfo

This will display a comprehensive list of hardware information for your system.

lsdev

The lsdev command displays information about all the devices on your system, including disks, tapes, CD-ROMs, printers, and serial ports. To use the lsdev command, simply open a terminal window and type −

$ lsdev

This will display a list of all the devices on your system.

Ifconfig

The ifconfig command displays information about your network interfaces, including their IP addresses, netmasks, and MAC addresses. This command can be helpful if you need to troubleshoot network issues or simply to learn more about your network configuration. To use the ifconfig command, simply open a terminal window and type −

$ ifconfig

This will display information about all your network interfaces.

Iwconfig

The iwconfig command displays information about your wireless network interfaces, including their SSIDs, signal strengths, and encryption settings. This command can be helpful if you need to troubleshoot wireless network issues or simply to learn more about your wireless network configuration. To use the iwconfig command, simply open a terminal window and type −

$ iwconfig

This will display information about all your wireless network interfaces.

Uptime

The uptime command displays information about how long your system has been running, along with its average load. This command can be helpful if you need to determine how long your system has been running or to troubleshoot performance issues. To use the uptime command, simply open a terminal window and type −

$ uptime

This will display how long your system has been running, along with its average load.

lsmod

The lsmod command displays information about the kernel modules currently loaded on your system. This command can be helpful if you need to determine which modules are loaded or to troubleshoot issues related to kernel modules. To use the lsmod command, simply open a terminal window and type −

$ lsmod

This will display a list of all the kernel modules currently loaded on your system.

lspcmcia

The lspcmcia command displays information about all the PCMCIA devices connected to your system. This command can be helpful if you need to determine which PCMCIA devices are installed on your system. To use the lspcmcia command, simply open a terminal window and type −

$ lspcmcia

This will display a list of all the PCMCIA devices connected to your system.

Conclusion

In conclusion, these are some of the most useful Linux commands for collecting system and hardware information. Whether you're troubleshooting issues or simply trying to learn more about your system, these commands can be invaluable tools. By mastering these commands, you can become more proficient in using Linux and better equipped to troubleshoot any issues that may arise.

Updated on: 27-Apr-2023

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements