Explore the Essential Command set for Linux to gain insight into your hardware
It is a good habit to know the hardware of the Linux system that is running, which can better complete the installation of software packages and driver compatibility issues on the subsequent system. Here are some common Linux commands for extracting information about system and hardware components.
View Linux system information:
tecmint@tecmint ~ $ uname
Linux
To view Linux network host names:
tecmint@tecmint ~ $ uname -n
tecmint.com
Obtain Linux kernel information:
tecmint@tecmint ~ $ uname -v
Obtain Linux kernel version information:
howtoing@howtoing ~ $uname -r. howtoing@howtoing ~ $uname -r
Print Linux hardware architecture name:
howtoing@howtoing ~ $uname -m. howtoing@howtoing ~ $uname -m
Print all the above information at once:
tecmint@tecmint ~ $ uname -a
To view Linux system hardware information such as CPU, disk, memory, USB controller, etc. lshw is a relatively small tool that provides information gleaned from different /proc files. The lshw command is executed by the root or sudo user.
tecmint@tecmint ~ $ sudo lshw
tecmint.com
description: Notebook
product: 20354 (LENOVO_MT_20354_BU_idea_FM_Lenovo Z50-70)
vendor: LENOVO
version: Lenovo Z50-70
serial: 1037407803441
width: 64 bits
capabilities: smbios-2.7 dmi-2.7 vsyscall32
configuration: administrator_password=disabled boot=normal
chassis=notebook family=IDEAPAD frontpanel_password=disabled
keyboard_password=disabled power-on_password=disabled
sku=LENOVO_MT_20354_BU_idea_FM_Lenovo Z50-70
uuid=E4B1D229-D237-E411-9F6E-28D244EBBD98
*-core
description: Motherboard
product: Lancer 5A5
vendor: LENOVO
physical id: 0
version: 31900059WIN
serial: YB06377069
slot: Type2 - Board Chassis Location
*-firmware
description: BIOS
vendor: LENOVO
physical id: 0
version: 9BCN26WW
date: 07/31/2014
size: 128KiB
capacity: 4032KiB
capabilities: pci upgrade shadowing cdboot bootselect edd
int13floppytoshiba int13floppy360 int13floppy1200 int13floppy720
int13floppy2880 int9keyboard int10video acpi usb biosbootspecification uefi
...
Print a summary of the hardware information with the -short option.
tecmint@tecmint ~ $ sudo lshw -short
H/W path Device Class Description
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
system 20354 (LENOVO_MT_20354_
BU_idea_FM_Lenovo Z50-70)
/0 bus Lancer 5A5
/0/0 memory 128KiB BIOS
/0/4 processor Intel(R) Core(TM) i5-4210U
CPU @ 1.70GHz
/0/4/b memory 32KiB L1 cache
/0/4/c memory 256KiB L2 cache
/0/4/d memory 3MiB L3 cache
/0/a memory 32KiB L1 cache
/0/12 memory 8GiB System Memory
/0/12/0 memory DIMM [empty]
/0/12/1 memory DIMM [empty]
/0/12/2 memory 8GiB SODIMM DDR3 Synchronous
1600 MHz (0.6ns)
/0/12/3 memory DIMM [empty]
/0/100 bridge Haswell-ULT DRAM Controller
/0/100/2 display Haswell-ULT Integrated
Graphics Controller
/0/100/3 multimedia Haswell-ULT HD Audio Controller
...
If you want to generate output in the form of an html file, you can use the option -html.
tecmint@tecmint〜$ sudo lshw -html > lshw.html
To view LinuxCPU information, you can use the Iscpu command to display information about the CPU architecture, such as the number of cpus from sysfs and /proc/cpuinfo, cores, CPU family models, CPU caches, threads, and so on.
tecmint@tecmint ~ $ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 69
Stepping: 1
CPU MHz: 768.000
BogoMIPS: 4788.72
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
The lsblk command is used to report information about block devices, as shown below.
tecmint@tecmint ~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 1000M 0 part
├─sda2 8:2 0 260M 0 part /boot/efi
├─sda3 8:3 0 1000M 0 part
├─sda4 8:4 0 128M 0 part
├─sda5 8:5 0 557.1G 0 part
├─sda6 8:6 0 25G 0 part
├─sda7 8:7 0 14.7G 0 part
├─sda8 8:8 0 1M 0 part
├─sda9 8:9 0 324.5G 0 part /
└─sda10 8:10 0 7.9G 0 part [SWAP]
sr0 11:0 1 1024M 0 rom
View all block devices on the system.
tecmint@tecmint ~ $ lsblk -a
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 1000M 0 part
├─sda2 8:2 0 260M 0 part /boot/efi
├─sda3 8:3 0 1000M 0 part
├─sda4 8:4 0 128M 0 part
├─sda5 8:5 0 557.1G 0 part
├─sda6 8:6 0 25G 0 part
├─sda7 8:7 0 14.7G 0 part
├─sda8 8:8 0 1M 0 part
├─sda9 8:9 0 324.5G 0 part /
└─sda10 8:10 0 7.9G 0 part [SWAP]
sdb 8:16 1 0 disk
sr0 11:0 1 1024M 0 rom
ram0 1:0 0 64M 0 disk
ram1 1:1 0 64M 0 disk
ram2 1:2 0 64M 0 disk
ram3 1:3 0 64M 0 disk
ram4 1:4 0 64M 0 disk
ram5 1:5 0 64M 0 disk
ram6 1:6 0 64M 0 disk
ram7 1:7 0 64M 0 disk
ram8 1:8 0 64M 0 disk
ram9 1:9 0 64M 0 disk
loop0 7:0 0 0 loop
loop1 7:1 0 0 loop
loop2 7:2 0 0 loop
loop3 7:3 0 0 loop
loop4 7:4 0 0 loop
loop5 7:5 0 0 loop
loop6 7:6 0 0 loop
loop7 7:7 0 0 loop
ram10 1:10 0 64M 0 disk
ram11 1:11 0 64M 0 disk
ram12 1:12 0 64M 0 disk
ram13 1:13 0 64M 0 disk
ram14 1:14 0 64M 0 disk
ram15 1:15 0 64M 0 disk
The lsusb command is used to report information about the USB controller and all the devices connected to it.
tecmint@tecmint ~ $ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 005: ID 0bda:b728 Realtek Semiconductor Corp.
Bus 002 Device 004: ID 5986:0249 Acer, Inc
Bus 002 Device 003: ID 0bda:0129 Realtek Semiconductor Corp.
RTS5129 Card Reader Controller
Bus 002 Device 002: ID 045e:00cb Microsoft Corp.
Basic Optical Mouse v2.0
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation
2.0 root hub