Gathering System Information
1. Displaying CPU Information
| Command | Description | Example Output |
|---|---|---|
| lscpu | Shows detailed CPU architecture information | |
| cat /proc/cpuinfo | Displays raw CPU information from the kernel | |
| nproc | Prints the number of processing units available | 8 |
| top | Shows real-time system processes including CPU usage | |
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) | |
| cat /proc/meminfo | Shows detailed memory statistics from the kernel | |
| vmstat | Reports virtual memory statistics including memory usage | |
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 |
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 | |
| lsusb -t | Display USB device tree structure | |
| lsusb -v | Verbose output including detailed device information | |
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 | |
| fdisk -l | Display detailed partition table information for all disks | |
| parted -l | Display partition tables using parted utility | |
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 | |
| lsblk | Lists block devices including disks and partitions | |
| lsmem | Displays memory layout and usage information | |
| dmidecode | Provides detailed system hardware information from SMBIOS | |
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 |
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 |
Note: The
vmstat and iostat commands require the sysstat package to be installed.