Skip to main content

Gathering System Information

1. Displaying CPU Information

Command Description Example Output
lscpu Shows detailed CPU architecture information
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
cat /proc/cpuinfo Displays raw CPU information from the kernel
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
stepping : 12
microcode : 0x85
cpu MHz : 1800.000
nproc Prints the number of processing units available 8
top Shows real-time system processes including CPU usage
top - 14:20:35 up 2 days,  1:20,  2 users,  load average: 0.05, 0.03, 0.05
Tasks: 186 total,   1 running, 185 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.5 us,  1.0 sy,  0.0 ni, 96.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

Example: Get CPU model name

grep "model name" /proc/cpuinfo | head -1

Example: Show CPU cores and threads

lscpu | grep -E "(Core(s) per socket|Socket(s)|Thread(s) per core)"

2. Viewing Memory Information

Command Description Example Output
free -h Displays memory usage in a human-readable format (GB, MB)
total        used        free      shared  buff/cache   available
Mem:           7.7G        2.1G        3.2G        156M        2.4G        5.2G
Swap:          2.0G          0B        2.0G
cat /proc/meminfo Shows detailed memory statistics from the kernel
MemTotal:        8034560 kB
MemFree:         3297560 kB
MemAvailable:    5348120 kB
Buffers:           65536 kB
Cached:         1420800 kB
vmstat Reports virtual memory statistics including memory usage
procs -----------memory---------- ---system-- -----io---- --system--
 r  b   swpd   free   buff  cache   si   so  bi    bo   in   cs
 1  0      0 3297560  65536 1420800    0    0   12    15    5   12

Example: Using free with different units

free -m
# Output in MB:
#               total        used        free      shared  buff/cache   available
# Mem:           7650        2048        3123         156        2379        5045
# Swap:          1953           0        1953

Example: Monitoring memory usage over time

watch -n 1 free -h
# Updates every second to show real-time memory usage

3. Listing PCI Devices

Command Description Notes
lspci List all PCI devices Basic command to display all PCI devices in a compact format
lspci -v Verbose listing of PCI devices Shows detailed information for each device including driver and configuration space
lspci -vv Very verbose listing of PCI devices Provides even more detailed information including all capabilities and extended headers
lspci -n Display device IDs in numeric format Shows vendor and device IDs as numbers instead of names
lspci -t Display device tree Shows the hierarchical structure of PCI devices
lspci -s <bus>:<slot> Display specific device Lists only the device at the specified bus and slot address

Example: Display all PCI devices with verbose output

lspci -vv

Example: Display only devices on bus 0000:00

lspci -s 0000:00
Note: The lspci command is part of the pciutils package and requires root privileges to access some device information.

4. Listing USB Devices

Command Description Example Output
lsusb List all USB devices connected to the system
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
lsusb -t Display USB device tree structure
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4, 5000M
lsusb -v Verbose output including detailed device information
Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64

Example: Find USB device by vendor ID

lsusb | grep -i "046d"
Note: The lsusb command requires the libusb package to be installed.

5. Viewing Block Devices

Command Description Example Output
lsblk List block devices with hierarchy and size information
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   50G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
└─sda2   8:2    0   49G  0 part [SWAP]
fdisk -l Display detailed partition table information for all disks
Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos

Device     Boot Start        End    Sectors   Size Id Type
/dev/sda1  *     2048   2099199    2097152     1G 83 Linux
/dev/sda2        2099200 104857599   102758400    49G 82 Linux swap / Solaris
parted -l Display partition tables using parted utility
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 50.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  1075MB  1074MB  ext4         boot  boot, esp
 2      1075MB  50.0GB  48.9GB  linux-swap   swap

Example: Identify mounted filesystems on block devices

lsblk -f
Note: The lsblk command is preferred for viewing block devices as it provides a hierarchical view and includes mount points.

6. Displaying Hardware Information

Command Description Example Output
lscpu Shows CPU architecture and configuration details
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
lsblk Lists block devices including disks and partitions
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   50G  0 disk
├─sda1   8:1    0    1G  0 part /boot
└─sda2   8:2    0   49G  0 part [SWAP]
nvme0n1 259:0    0   20G  0 disk
└─nvme0n1p1 259:1    0   20G  0 part /home
lsmem Displays memory layout and usage information
AGE RANGE SIZE RO RW ALLOCATED
0-1 0x0000000000000000-0x0000000000000000 0B 0 0 0
2-3 0x0000000000000000-0x0000000000000000 0B 0 0 0
dmidecode Provides detailed system hardware information from SMBIOS
Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: Dell Inc.
	Product Name: Inspiron 15 3000
	Version: Not Specified
	Serial Number: ABC123456789

Example: Using lshw to get detailed hardware info

lshw -class memory

Example: Displaying network hardware info

lspci | grep -i ethernet

7. Listing Loaded Modules

Command Description Notes
lsmod Lists currently loaded kernel modules Simple and human-readable output
cat /proc/modules Displays loaded modules from /proc filesystem More detailed and structured format
modinfo <module_name> Shows metadata and information about a specific module Useful for debugging or understanding module details

Example: Using lsmod to list loaded modules

lsmod

Example: Using modinfo to get details of a module

modinfo nf_conntrack

8. Viewing BIOS Information

Command Description Notes
dmidecode Retrieve BIOS and system information from DMI/SMBIOS tables Requires root privileges or specific permissions
dmidecode -t bios Display only BIOS-specific information Shows version, release date, vendor, and features
dmidecode -t system Display system information (manufacturer, model) Useful for identifying hardware details

Example: Display BIOS Information

$ sudo dmidecode -t bios
# Output example:
# BIOS Information
# Vendor: Dell Inc.
# Version: 1.10.0
# Release Date: 06/23/2023
# Features:
#   - USB Support
#   - Boot from CD/DVD
Note: Not all systems expose full BIOS details via dmidecode. Some may require specific hardware support or kernel modules.

9. Checking Manufacturer Information

Command Description Example Output
dmidecode -s system-manufacturer Displays the system manufacturer name Dell Inc.
dmidecode -s system-product-name Displays the system product name PowerEdge R750
dmidecode -s system-version Displays the system version 1.0
dmidecode -s system-serial-number Displays the system serial number 1234567890
dmidecode -s chassis-manufacturer Displays the chassis manufacturer name Dell Inc.
dmidecode -s chassis-serial-number Displays the chassis serial number 0987654321
Note: dmidecode requires root privileges to access all system information.

Example: Retrieve System Manufacturer

<pre><code>$ sudo dmidecode -s system-manufacturer
Dell Inc.</code></pre></div>

10. Viewing System Statistics

Command Description Example Output
uptime Shows system uptime, number of users, and load averages 14:23:45 up 2 days, 3:15, 2 users, load average: 0.15, 0.10, 0.05
vmstat Reports virtual memory statistics including CPU, memory, and I/O procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
iostat Shows CPU and I/O statistics per device or partition Device: tps kB_read/s kB_wrtn/s
sar System Activity Reporter - collects and reports system activity 14:25:01 CPU %user %nice %system %iowait %steal %idle

Example: Using vmstat to check memory usage

vmstat 1 5

Example: Using iostat to monitor disk I/O

iostat -x 1 3
Note: The vmstat and iostat commands require the sysstat package to be installed.

Was this article helpful?