Hardware

Hardware & Linux

It is important to understand how to configure hardware and display the hardware of your Linux system. You might upgrade or add new hardware to your system. Just like Windows, you might need to install drivers (in Linux we call these modules). You will also learn about kernel modules and how to display them. We will also learn about a couple special filesystems in Linux (sysfs and procfs ).

ls commands

Linux makes it very easy to learn about your hardware on the command line. There are several commands that can be used.

lspci: this command lists your PCI devices

lsmod: this command lists & shows the status of your kernel modules

lsblk: this command provides a list of your block devices

lsusb: this command provides a list of all your USB devices

lscpu: this command provides details about your CPU.

With using each of these commands a great understanding of the hardware the system has installed can be learned.

https://linux.die.net/man/8/lspci

https://linux.die.net/man/8/lsmod

https://linux.die.net/man/8/lsblk

https://linux.die.net/man/8/lsusb

https://linux.die.net/man/1/lscpu

insmod & modprobe & rmmod

Linux has come a long way in the last several years. When I first started to use Linux I was using these commands more frequently, but I find myself rarely using them. I really only use them when I have some hardware that does not have great Linux support and Linux is trying to use the wrong module for the device. This does not happen often, so do not stress about it. These commands are being included just so you know how to add and remove kernel modules.

modprobe: This command is very easy to use. Just provide the name of the module you wish to add and it will do the work for you. You can also use modprobe to remove a module (module -r).

insmod: Not as user friendly as modprobe, but does the same thing except you need to provide the location of the module to add.

rmmod: Removes a module from the kernel.

https://linux.die.net/man/8/modprobe

https://linux.die.net/man/8/insmod

https://linux.die.net/man/8/rmmod

Non Built in Commands

Here are some commands that I have come across that also display a lot of hardware information. Some of these commands provide a nice pretty ascii art with all your system information too. Keep in mind that you will be required to download and install these.

Each of these commands are just being provided for your information and just to show you that in Linux there are many ways to get the same information.

sysfs

This is a virtual filesytem that the kernel exports. The sysfs filesytem is mounted on /sys. This virtual filesystem was created due to help clean up another virtual filesystem called procfs. The sysfs filesystem contains detailed information about hardware. To learn more about sysfs make sure to read the following URL:

https://www.thegeekdiary.com/understanding-the-sysfs-file-system-in-linux/

procfs

This is another virtual filesystem that the kernel exports. The procfs filesystem is mounted in the /proc directory. The /proc directory contains a lot of information about the current state of the kernel. Within the /proc directory there are also files that you can update o change the configuration of the kernel.

To learn more about the procfs make sure to read the following URL:

https://www.thegeekdiary.com/understanding-the-proc-file-system/

free

The free command is a great way to learn about how much memory is currently being used. It shows you the total amount of memory the system has and what is being used. The free command also shows you details about your swap partition! Great command to use to learn about your systems memory usage.

https://linux.die.net/man/1/free