Some useful commands that can help you to extract information about your Linux system and hardware.
Get System Information of your system
Use uname command
uname (short for unix name) is a command in Linux/Unix that prints the name, version and other details about your system.
Display all information of the uname command with -a option as shown below
[admin@serverhow.com ~]$ uname -a
Linux laptop 4.4.0-145-generic #171-Ubuntu SMP Tue Mar 26 12:43:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Print the Linux Kernel name, use “-s” option
- Print Linux Kernel Release, use “-r” option
- Print the Linux Kernel Version, use “-v” option
- Print Machine Hardware Architecture (i386, x86_64, etc…)
The output x86_64 means that you are using a 64-bit architecture. Also output i686 means that a user is on a 32-bit system.
Also, you can use cat command to get system information of your machine
[admin@serverhow.com ~]$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
Get Harware Information of your system
List all hardware information
[admin@serverhow.com ~]$ lshw
laptop
description: Laptop
product: Inspiron 7566 (0797)
vendor: Dell Inc.
serial: C6KJSC2
width: 64 bits
capabilities: smbios-2.8 dmi-2.8 vsyscall32
configuration: boot=normal chassis=docking family=Inspiron sku=0797 uuid=44454C4C-3600-104B-804A-C3C04F534332
*-core
description: Motherboard
product: 042NDD
vendor: Dell Inc.
physical id: 0
version: A00
serial: /C6KJSC2/CN129636AT00A6/
*-firmware
description: BIOS
vendor: Dell Inc.
physical id: 0
...
Get CPU Information
To view information about your CPU, use the lscpu command as it shows information about your CPU architecture such as number of CPU’s, cores, CPU family model, CPU caches, threads, etc from sysfs and /proc/cpuinfo.
[admin@serverhow.com ~]$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Stepping: 3
CPU MHz: 813.921
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 5183.87
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb invpcid_single intel_pt ssbd ibrs ibpb stibp kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d
Or
[admin@serverhow.com ~]$ cat /proc/cpuinfo
Collect Linux Block Device Information
[admin@serverhow.com ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 119.2G 0 disk
├─sda1 8:1 0 500M 0 part /boot/efi
├─sda2 8:2 0 128M 0 part
├─sda3 8:3 0 49.2G 0 part
├─sda4 8:4 0 52.4G 0 part /
├─sda5 8:5 0 3.8G 0 part [SWAP]
├─sda6 8:6 0 450M 0 part
├─sda7 8:7 0 11.7G 0 part
└─sda8 8:8 0 1.1G 0 part
sdb 8:16 0 465.8G 0 disk
├─sdb1 8:17 0 128M 0 part
loop0 7:0 0 91.1M 1 loop /snap/core/6531
loop1 7:1 0 89.3M 1 loop /snap/core/6673
loop2 7:2 0 89.4M 1 loop /snap/core/6818
Print USB Controllers Information
[admin@serverhow.com ~]$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2a Intel Corp.
Bus 001 Device 004: ID 1bcf:28c1 Sunplus Innovation Technology Inc.
Bus 001 Device 002: ID 1a81:1007 Holtek Semiconductor, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Print PCI Devices Information
[admin@serverhow.com ~]$ lspci
Print SCSI Devices Information
[admin@serverhow.com ~]$ lsscsi
To install lsscsi command, please run commands below:
# For Ubuntu/Debian systems
sudo apt-get install lsscsi
# For CentOS/Redhat systems
sudo yum install lsscsi
Print Linux File System Information
[admin@serverhow.com ~]$ sudo fdisk -l
Or
[admin@serverhow.com ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 785M 9.5M 776M 2% /run
/dev/sda4 52G 42G 7.0G 86% /
tmpfs 3.9G 19M 3.9G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop0 92M 92M 0 100% /snap/core/6531
/dev/loop1 90M 90M 0 100% /snap/core/6673
/dev/loop2 90M 90M 0 100% /snap/core/6818
/dev/sda1 496M 66M 431M 14% /boot/efi
tmpfs 785M 100K 785M 1% /run/user/1000
Check Memory infomation
[admin@serverhow.com ~]$ cat /proc/meminfo
Use free command to check memory space of your systems.
[admin@serverhow.com ~]$ free -m
total used free shared buff/cache available
Mem: 7845 5599 450 351 1795 1534
Swap: 3905 106 3799