Get System Information from the Command Line
You can get detailed system information from the command line using built-in tools like systeminfo on Windows, uname and lscpu on Linux/macOS, and wmic (deprecated) or PowerShell on Windows. These commands display your OS version, CPU, RAM, disk, and network details without installing anything.
Why Use the Command Line?
Graphical system info panels (like Windows Settings or macOS About This Mac) show only a summary. The command line gives you the full picture: exact CPU model, core count, RAM speed, disk model, BIOS version, network adapters, and installed hotfixes. It is also scriptable—you can save the output to a file, compare it across machines, or automate troubleshooting.
For IT admins and power users, the command line is often faster and more reliable, especially when the GUI won’t load (e.g., during a boot failure or remote session).
Windows: Built-in Commands
Windows offers several built-in commands. Open Command Prompt (cmd) or PowerShell and try these:
systeminfo– Shows OS version, build, manufacturer, RAM, BIOS, and network info. It takes a few seconds to gather everything.wmic cpu get name,numberofcores,numberoflogicalprocessors– CPU details (wmic is deprecated in newer Windows, but still works in most versions).wmic memorychip get capacity,speed,manufacturer– RAM module details.wmic diskdrive get model,size,status– Physical disk info.ipconfig /all– Network adapter details, IP addresses, MAC addresses, DNS servers.
For a more modern approach, PowerShell cmdlets like Get-ComputerInfo (Windows 10/11) provide a rich object you can filter. Example: Get-ComputerInfo | Select-Object OsName,OsVersion,CsTotalPhysicalMemory.
Linux and macOS: uname and Friends
On Linux and macOS, the terminal is your friend. The core command is uname:
uname -a– Kernel name, hostname, kernel release, machine architecture.uname -r– Kernel release only.uname -m– Machine hardware (e.g., x86_64, arm64).
For more detail, Linux users can run:
lscpu– CPU architecture, cores, threads, model name, flags.free -h– RAM usage and total.lsblk– Block devices (disks and partitions).lspci– PCI devices (graphics cards, network controllers).lsusb– USB devices.hostnamectl– System info including OS version (on systemd-based distros).
macOS users can use system_profiler for a comprehensive report: system_profiler SPHardwareDataType shows model, CPU, memory, serial number. sw_vers gives macOS version and build.
How to Choose the Right Command
The best command depends on what you need:
- OS version only:
ver(Windows),sw_vers(macOS),cat /etc/os-release(Linux). - CPU details:
wmic cpuorGet-CimInstance Win32_Processor(Windows),lscpu(Linux),sysctl -n machdep.cpu.brand_string(macOS). - RAM total:
systeminfo(Windows),free -h(Linux),sysctl hw.memsize(macOS). - Disk space:
wmic logicaldisk get size,freespace(Windows),df -h(Linux/macOS). - Network config:
ipconfig(Windows),ifconfigorip addr(Linux/macOS).
When in doubt, start with systeminfo on Windows or uname -a on Unix-like systems—they give a broad overview.
Common Problems and Pitfalls
Here are issues you might run into:
- Command not recognized: On Windows,
wmicmay be missing on newer builds; use PowerShell instead. On Linux, some tools likelscpumay not be installed by default—install with your package manager (e.g.,apt install util-linux). - Permission denied: Some commands (like
lspcion some systems) may needsudo. Run withsudo lspci. - Output too long: Pipe to
moreorfindstron Windows, orgrepon Unix. Example:systeminfo | findstr /i "memory". - Locale issues: Output may be in your system language. Use
chcp 437on Windows cmd to force English, or setLC_ALL=Con Linux.
Comparing Windows, Linux, and macOS
All three OSes have similar capabilities but different syntax. Windows leans on wmic (legacy) and PowerShell (modern). Linux uses a collection of small tools (lscpu, free, lsblk). macOS is Unix-based but lacks lscpu; it uses system_profiler and sysctl instead. If you know one, you can often guess the other—but always check the man page (man command) for exact options.
For scripting, PowerShell on Windows and bash on Unix are both powerful. You can save output to a text file with systeminfo > info.txt or uname -a > info.txt.
Safety and Privacy
These commands are read-only—they do not change anything on your system. They are safe to run. However, be aware that the output may contain sensitive information like your hostname, MAC address, or serial number. If you share the output publicly (e.g., on a forum), redact such details. Also, avoid running unknown commands from the internet that claim to “gather system info”—they might be malicious. Stick to the built-in tools mentioned here.
Frequently Asked Questions
How do I get the Windows version from the command line?
Run ver in Command Prompt to get a short string like “Microsoft Windows [Version 10.0.19045.3324]”. For more detail, use systeminfo and look at the “OS Name” and “OS Version” lines.
What is the difference between uname and lscpu?
uname shows the kernel and hardware architecture (e.g., x86_64). lscpu gives detailed CPU information including cores, threads, model name, and cache sizes. They serve different purposes—uname is more about the OS/kernel, lscpu about the processor.
How can I get system info on a remote computer?
On Windows, you can use systeminfo /s RemoteComputerName (requires admin rights). On Linux, use SSH: ssh user@host "lscpu". PowerShell also has Get-ComputerInfo -ComputerName but requires WinRM setup.
Why does systeminfo take so long?
It queries many components including network adapters, installed hotfixes, and BIOS info. On slow or busy systems, it can take 10-30 seconds. If you only need a specific piece, use a targeted command like wmic cpu for CPU or ipconfig for network.
Is wmic deprecated? What should I use instead?
Yes, Microsoft deprecated WMIC in Windows 10 21H1 and removed it in Windows 11. Use PowerShell cmdlets like Get-CimInstance Win32_Processor or Get-ComputerInfo instead.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.