How to Quickly Inspect Server Hardware and OS Details on Linux
This guide walks you through querying a Linux server's basic configuration—including OS version, kernel, CPU specs, memory usage, disk usage, and block device details—using common command‑line tools with clear examples and explanations.
Introduction
When taking over one or more servers, understanding their basic configuration is essential for effective software deployment and system maintenance.
1. Operating System Information
Use the following commands to view OS version and kernel details: # cat /etc/redhat-release Displays the Red Hat‑based distribution version, e.g., CentOS Linux release 7.4.1708 (Core). # cat /etc/issue Works on most Linux distributions to show a brief OS description. # uname -r Shows the kernel version, e.g., 3.10.0-693.el7.x86_64. # uname -a Provides full kernel and system information, revealing hostname, architecture, and more.
2. CPU Details
Key terminology:
Physical CPUs : Number of CPU sockets installed.
CPU cores : Number of processing cores per socket.
Logical CPUs / Threads : Physical CPUs × cores, plus hyper‑threading if present.
Commands to retrieve CPU information:
# grep 'physical id' /proc/cpuinfo | sort -u | wc -lReturns the count of physical CPUs.
# grep 'core id' /proc/cpuinfo | sort -u | wc -lShows the number of cores. # cat /proc/cpuinfo | grep processor | wc -l Displays the total logical CPU count (threads). # cat /proc/cpuinfo | grep name | sort | uniq Shows the CPU model, e.g., Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz. # lscpu Provides a concise summary of architecture, CPU(s), cores, threads, sockets, cache sizes, and flags.
3. Memory Information
Key terms:
Mem : Physical memory usage.
Swap : Virtual memory on disk.
Buffers and Cached : Memory used for I/O buffering and cached file data.
Command to view memory status: # free -m Outputs total, used, free, shared, buff/cache, and available memory in megabytes.
To monitor memory continuously every 3 seconds:
# free -s 34. Disk Usage
Overall disk usage: # df -h Shows filesystem size, used space, available space, and usage percentage in human‑readable format.
Directory‑specific usage: # du -sh /home/ Summarizes the total size of /home. Use -a, -h, --max-depth, etc., for more detailed reports.
Tree view of directory structure (requires tree package):
# yum -y install tree # tree -L 2 /home/5. Block Device Details
List block devices with sizes and mount points: # lsblk Provides columns for NAME, MAJ:MIN, RM, SIZE, RO, TYPE, and MOUNTPOINT.
Show UUIDs, filesystem types, and labels: # blkid Outputs each device’s UUID and TYPE, useful for identifying partitions.
Conclusion
By running these simple commands, you can quickly gather comprehensive information about a Linux server’s operating system, CPU, memory, storage, and block devices, enabling informed decisions for deployment, troubleshooting, and performance tuning.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
