Checking System Information in Linux
In the Linux operating system, there are various ways to check system information, ranging from basic commands to advanced tools. As a Linux expert and mentor, I'll guide you through the most common and useful methods to help you better understand your system.
Using Basic Linux Commands
The most straightforward way to check system information in Linux is by using a set of built-in commands. These commands provide a quick and easy way to retrieve essential system details.
uname
: This command displays information about the current operating system, including the kernel version, machine hardware name, and more. For example, runninguname -a
will show you the complete system information.
$ uname -a
Linux myhost 5.10.0-19-generic #20-Ubuntu SMP Fri May 7 14:21:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
lsb_release
: This command provides information about the Linux distribution, including the version and codename. For example,lsb_release -a
will display the distribution details.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
cat /etc/os-release
: This command displays the operating system release information, including the distribution name, version, and ID.
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="21.04 (Hirsute Hippo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 21.04"
VERSION_ID="21.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=hirsute
UBUNTU_CODENAME=hirsute
lshw
: This command provides detailed information about the hardware components of your system, including the CPU, memory, storage, and more. You can runlshw
to see the full hardware inventory.
$ sudo lshw
[sudo] password for user:
*-core
description: Motherboard
product: PRIME Z490-P
vendor: ASUSTeK COMPUTER INC.
physical id: 0
version: Rev X.0x
serial: 123456789
*-cpu
description: CPU
product: Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
vendor: Intel Corp.
physical id: cpu
bus info: cpu@0
version: Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
slot: LGA1200
size: 2900MHz
capacity: 3800MHz
width: 64 bits
clock: 100MHz
*-memory
description: System Memory
physical id: memory
size: 16GiB
*-disk
description: ATA Disk
product: WDC WD10EZEX-00B
vendor: Western Digital
physical id: disk
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 1A01
serial: WD-WCC4M0XXXXXXX
size: 931GiB (1TB)
capabilities: gpt-1.00 partitioned_table partitioned
configuration: ansiversion=5 guid=12345678-abcd-efgh-ijkl-mnopqrstuvwx
Using Advanced System Information Tools
While the basic Linux commands provide a good starting point, there are also more advanced tools available to delve deeper into system information.
hwinfo
: This command-line tool offers a comprehensive overview of the hardware components in your system, including detailed information about the CPU, memory, storage, network, and more.
$ sudo hwinfo --short
cpu:
Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
memory:
16384 MB
disk:
/dev/sda (931.51 GB)
network:
enp3s0: Ethernet controller
wlp2s0: Wireless interface
graphics:
VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1660 SUPER] (rev a1)
inxi
: This is a powerful system information script that provides a detailed report on your system's hardware, software, and system configuration. It can be especially useful for troubleshooting and support purposes.
$ inxi -Fxz
System:
Kernel: 5.10.0-19-generic x86_64 bits: 64 compiler: gcc v: 10.3.0
Desktop: Gnome 3.38.5 Distro: Ubuntu 21.04 (Hirsute Hippo)
Machine:
Type: Desktop Mobo: ASUSTeK model: PRIME Z490-P v: Rev X.0x
serial: 123456789 UEFI: American Megatrends v: 2201 date: 04/08/2021
CPU:
Topology: 6-Core model: Intel Core i5-10400F bits: 64 type: MCP
arch: Comet Lake rev: A0 cache: L1: 384 KiB L2: 1.5 MiB L3: 12 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
bogomips: 29600
Speed: 2900 MHz min/max: 800/3800 MHz Core speeds (MHz): 1: 2900 2: 2900
3: 2900 4: 2900 5: 2900 6: 2900
Graphics:
Device-1: NVIDIA TU116 [GeForce GTX 1660 SUPER] vendor: ASUSTeK
driver: nvidia v: 470.57.02
Display: x11 server: X.Org 1.20.11 driver: nvidia
resolution: 1920x1080~144Hz
OpenGL: renderer: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2
version: 4.6.0 NVIDIA 470.57.02
lsblk
: This command provides a tree-like listing of all block devices (storage devices) in your system, including partitions, logical volumes, and their attributes.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
└─sda2 8:2 0 930.9G 0 part /
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot
└─nvme0n1p2 259:2 0 476.4G 0 part /
Visualizing System Information with Mermaid
To help you better understand the relationships between different system components, let's use a Mermaid diagram:
This diagram shows the main categories of system information tools in Linux, including the basic commands and the more advanced tools. By using these tools, you can quickly and efficiently gather the necessary information about your Linux system.
Remember, the key to effectively checking system information in Linux is to understand the purpose and capabilities of each command or tool, and to use them in combination to get a comprehensive view of your system's hardware, software, and configuration.