10 Linux Commands to Collect System and Hardware Information
As a Linux user, it is important to know how to gather system and hardware information. This article will provide you with 10 Linux commands that can be used to collect important information about your system and hardware.
1. uname
The “uname” command is used to display certain system information such as operating system name, kernel version, and hostname. Here is an example:
$ uname -a
Linux example-PC 5.4.0-67-generic #75-Ubuntu SMP Fri Feb 19 18:03:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
2. lspci
The “lspci” command is used to display information about PCI buses and devices that are connected to them. Here is an example:
$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 05)
...
3. lsblk
The “lsblk” command is used to display block device information. It shows all the connected storage devices including hard drives, USB drives and CD-ROM drives. Here is an example:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 500M 0 part /boot/efi
├─sda2 8:2 0 488M 0 part /boot
├─sda3 8:3 0 872.6G 0 part /
4. df
The “df” command is used to display disk space usage. It displays file system disk space usage on all mounted file systems. Here is an example:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8163660 0 8163660 0% /dev
tmpfs 1636584 2276 1634308 1% /run
5. cat /proc/cpuinfo
The “cat /proc/cpuinfo” command is used to display information about the CPU. It provides detailed information about the processor, such as its model, speed, and features. Here is an example:
$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 6
model name : AMD Phenom(tm) II X6 1045T Processor
stepping : 2
cpu MHz : 3000.000
cache size : 512 KB
...
6. free
The “free” command is used to display the amount of free and used memory on your system. It also shows the amount of memory used by buffers and cache. Here is an example:
$ free
total used free shared buff/cache available
Mem: 8068876 2213600 2608244 443232 3246032 5015364
Swap: 2097148 0 2097148
7. top
The “top” command is used to display real-time information about your system, including CPU usage, memory usage, and running processes. Here is an example:
$ top
top - 11:25:50 up 35 days, 22:35, 1 user, load average: 0.36, 0.41, 0.44
Tasks: 285 total, 1 running, 284 sleeping, 0 stopped, 0 zombie
%Cpu(s): 6.9 us, 1.0 sy, 0.0 ni, 92.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 7878.5 total, 1145.9 free, 5155.5 used, 1577.1 buff/cache
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 5266.7 avail Mem
8. lspcu
The “lspcu” command is used to display information about processors, including architecture, speed, and cache. Here is an example:
$ lspcu
Thread 1 of 1 cores
---------------------
CPU Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 6
On-line CPU(s) list: 0-5
Thread(s) per core: 1
Core(s) per socket: 6
CPU socket(s): 1
Vendor ID: AuthenticAMD
CPU family: 21
Model: 2
9. hwinfo
The “hwinfo” command is used to display detailed hardware information about your system. It provides information about the CPU, memory, disk, graphics card, and other hardware components. Here is an example:
$ hwinfo
cpu:
AMD Phenom(tm) II X6 1045T Processor, 795 MHz
AMD Phenom(tm) II X6 1045T Processor, 2400 MHz
AMD Phenom(tm) II X6 1045T Processor, 3000 MHz
AMD Phenom(tm) II X6 1045T Processor, 2987 MHz
AMD Phenom(tm) II X6 1045T Processor, 795 MHz
AMD Phenom(tm) II X6 1045T Processor, 2400 MHz
...
10. dmidecode
The “dmidecode” command is used to display information about your system’s hardware components. It provides detailed information about your system such as manufacturer, BIOS version, RAM details, etc. Here is an example:
$ dmidecode -t system
# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: Lenovo
Product Name: 20175
Version: Lenovo IdeaPad Z580
[...]
Wake-up Type: Power Switch
SKU Number: Lenovo IdeaPad Z580
Family: IDEAPAD
Conclusion
In conclusion, these 10 Linux commands can be extremely useful when it comes to collecting system and hardware information. Learning how to use them can help you diagnose and troubleshoot issues with your system, and can also help you understand the hardware components in your system better.