There are three ways to find out about your computer hardware.
The first way would be to examine it, a method which I personally consider to be a bit too hands-on and messy for everyday application.
The second way would be to read the manual that came with it, but let’s be realistic… who actually reads those things, much less saves them? *Raises hand then slinks away guiltily.*
So that leaves us with the third option, which is to ask the software. Because what knows more about the hardware, than the software interacting with it?
There are quite a few Linux commands that display details about a system’s hardware. Today’s focus will be on eight of those commands — and specifically eight that work on Fedora Linux.
The dmidecode Command
The dmidecode command will display the system’s Desktop Management Interface (DMI), or System Management BIOS (SMBIOS), in a human-readable format.
You can cut down on how much date is displayed by being specific about what you want to see. Examples:
dmidecode -t memory and
dmidecode -t processor
The lshw Command
The lshw command lists the system hardware.
On some systems, it may be necessary to
yum install lshw (or
dnf install lshw) prior to running it.
Because the output can be looooong and hard to sort through, it is handy to use the arguments to sort through it for you. Some arguments are:
-short will list a summary of the hardware details.
-class will only list details for a specific class of hardware (memory, processor, bus, system, display, disk, etc.) The syntax is:
lshw - class network
-businfo will show the bus info of the device list, including SCSI, USB, IDE and PCI addresses.
The lscpu Command
The lscpu command displays information about the CPU architecture.
So… basically, if someone asks you the make and model of your CPU, type this in and then you’ll be able to tell them!
The free Command
The free command displays the amount of free and used memory in the system.
The memory is displayed in kilobytes by default, but arguments are available to change the measurement used.
-b will display the amount of memory in bytes.
-k will display the amount of memory in kilobytes. This is the default.
-m will display the amount of memory in megabytes.
-g will display the amount of memory in gigabytes.
–tera will display the amount of memory in terabytes.
The lspci Command
The lspci command will list all the system’s PCI buses, along with the devices connected to them.
The various cards plugged into your motherboard (graphics, network, etc.) are examples of the devices you might see in this list.
The df Command
The df command reports on file system disk space usage. Additionally, the command reports the file system and mount point of each disk.
My favorite argument is -h, as it will display the sizes in an actual human-readable format.
The fdisk -l Command
The fdisk command manipulates disk partition table.
Disk partitions are a whole separate subjects in themselves, so let’s just say for now that a disk drive can be divided and used for different purposes/file systems/etc.
I find this command useful specifically for the -l argument, which lists the partition tables of all of the disks that it finds.
The lsblk Command
The lsblk command lists the system’s block devices in a simple tree-like format.
What I like about this command is that it provides multiple useful details such as the device name, size (in human-readable format!) and mount point.
The -f argument will show each device’s type of file system.
The -m argument will show each device’s owner, group and mode.
The -O argument will show all available columns.
The -p argument will show each device’s full path.
The lsusb Command
The lsusb command will list the USB buses available, as well as the devices connected to them.
If you have time, try out each command and see what they do for yourself, to better determine which command(s) you prefer, either in general or for specific applications.
And yes, I can count, but a 9th command was added later, so we’re calling it a bonus!
I prefer dmidecode over lshw as it is easier to read.