Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to find out hardware information for the below items under Linux:

  • CPU (and cores)
  • CPU speed
  • Memory
  • Hard disks
  • OS version

Any advice?

share|improve this question

migrated from stackoverflow.com Jun 29 '11 at 15:44

This question came from our site for professional and enthusiast programmers.

add comment

9 Answers

From Linux Commands - A practical reference:

Show kernel version and system architecture

uname -a

Show name and version of distribution

head -n1 /etc/issue

Show all partitions registered on the system

cat /proc/partitions

Show RAM total seen by the system

grep MemTotal /proc/meminfo

Show CPU(s) info

grep "model name" /proc/cpuinfo

Show info about disk sda

hdparm -i /dev/sda
share|improve this answer
    
+1 for the link. Not only did you answer the Q but the link is really useful. Thanks –  lordlupine May 1 '13 at 17:27
add comment

Try lshw

It will suggest you run it as root, so try

sudo lshw
share|improve this answer
1  
you will need to install it in many cases - iirc it wasn't stock in ubuntu –  Journeyman Geek Jun 29 '11 at 15:46
add comment

Here is a list of commands to check hardware on Linux. Note that not all commands are available on all distributions. It is better to launch then as root (or via sudo) to get all the information.

Command: lscpu

  • List available cpus and their caracteristics
  • Not available on older distribution

Command: lshal

  • Require HAL (Hardware Abstraction Layer) to be installed
  • List all hardware visible by HAL

Command: lshw

  • Available on Ubuntu based distributions by default, and Debian in the main repo
  • Available in the Fedora repositories
  • Uses many inputs to detect all hardware: Kernel, HAL, DMI, etc.
  • As a neat ‘-html’ switch that generates hardware reports
  • Check more on this page

Command: lspci

  • Standard command
  • List all hardware connected to the PCI bus as detected by the kernel

Command: lsusb

  • Standard command
  • List all hardware connected to the USB buses as detected by the kernel

Command: dmidecode

  • Standard command
  • Get the source information from the DMI (a kind of BIOS interface)
  • List all hardware as reported by the DMI interface
share|improve this answer
    
On Debian at least lshw is not installed by default. "apt-get install lshw" helps –  Andreas Kuckartz Oct 12 '13 at 7:44
1  
Thanks Andreas for the information, I will update my post. –  Huygens Oct 12 '13 at 12:30
add comment

Here is a link to various Linux commands for what you want:

http://www.cyberciti.biz/tips/linux-command-to-gathers-up-information-about-a-linux-system.html

Specifically, you're looking for commands like:

cat /proc/cpuinfo

free -m

cat /proc/version
share|improve this answer
add comment

And, just to add my two cents worth, I would also try

hwinfo

Before using the full comand, you might perhaps try the short version,

hwinfo --short

which might already provide the info you are searching for. The fll version is very rich in details, so it is probably best called with

hwinfo | more

And, by the way, a convenient condensed form of the info provided by lshw can be obtained by means of

sudo lshw -businfo

with easily readable output:

Bus info          Device      Class          Description
========================================================
                              system         PORTEGE R930 (PT331E)
                              bus            PORTEGE R930
                              memory         128KiB BIOS
                              memory         6GiB System Memory
                              memory         4GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
                              memory         2GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
cpu@0                         processor      Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
                              memory         32KiB L1 cache
                              memory         256KiB L2 cache
                              memory         4MiB L3 cache
                              memory         32KiB L1 cache
pci@0000:00:00.0              bridge         3rd Gen Core processor DRAM Controller
pci@0000:00:02.0              display        3rd Gen Core processor Graphics Controller
pci@0000:00:14.0              bus            7 Series/C210 Series Chipset Family USB xHCI     Host Controller
pci@0000:00:16.0              communication  7 Series/C210 Series Chipset Family 
                                             MEI Controller #1
pci@0000:00:16.3              communication  7 Series/C210 Series Chipset Family KT Controller
pci@0000:00:19.0  eth0        network        82579LM Gigabit Network Connection
pci@0000:00:1a.0              bus            7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
pci@0000:00:1b.0              multimedia     7 Series/C210 Series Chipset Family High Definition Audio Controller
pci@0000:00:1c.0              bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 1
pci@0000:01:00.0              generic        MMC/SD Host Controller
pci@0000:00:1c.1              bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 2
pci@0000:00:1c.2              bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 3
pci@0000:04:00.0  wlan0       network        Centrino Advanced-N 6235
pci@0000:00:1c.5              bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 6
pci@0000:00:1d.0              bus            7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
pci@0000:00:1f.0              bridge         QM77 Express Chipset LPC Controller
pci@0000:00:1f.2              storage        7 Series Chipset Family 6-port SATA Controller [AHCI mode]
                 scsi0       storage        
scsi@0:0.0.0      /dev/sda    disk           256GB TOSHIBA THNSNF25
scsi@0:0.0.0,1    /dev/sda1   volume         27GiB EXT4 volume
scsi@0:0.0.0,2    /dev/sda2   volume         210GiB Extended partition
                 /dev/sda5   volume         5722MiB Linux swap / Solaris partition
                 /dev/sda6   volume         204GiB Linux filesystem partition
                 scsi2       storage        
scsi@2:0.0.0      /dev/cdrom  disk           DVD-RAM UJ8C2
                             power          Lithium Ion Battery
                          power          
                 wwan0       network        Ethernet interface

There is also a graphical version of lshw, called lshw-gtk:

sudo lshw-gtk &

Depeding on the specific distro you are on, most of these commands may need to be installed (apt-get install, yum, pacman, ...)

share|improve this answer
add comment

If you want lots of information about all of the devices connected to your machine over the PCI (or PCI-Express) bus then type lspci -vvknnqq

If you want information about your disk partitioning then type sudo fdisk -l /dev/sda

share|improve this answer
add comment

You can also use dmidecode which will provide description of the systemâs hardware components.

share|improve this answer
add comment

I am a co-developer of a utility that is making its way into several distributions (Debian Unstable is the newest addition). The tools is called inxi. It is a bash script that does what all the other answers here suggest in one easy command. Check it out.

To use it, simple go to a terminal and type 'inxi -F' and it will display a full (-F) system information output. 'inxi -h' will show more options. It was originally made for IRC troubleshooting, so it works in almost every IRC client (and comes boundled in some).

share|improve this answer
add comment

If you use puppet to manage your infrastructure, use facter

facter processorcount sp_number_processors sp_current_processor_speed memorytotal operatingsystem  osfamily operatingsystemrelease

processorcount => 4
sp_current_processor_speed => 2.5 GHz
sp_number_processors => 2
memorytotal => 8.00 GB
osfamily => RedHat
operatingsystem => CentOS
operatingsystemrelease => 6.5

You can even output as yaml or json

facter osfamily operatingsystem --json
{"osfamily":"Darwin","operatingsystem":"Darwin"}

facter osfamily operatingsystem --yaml
osfamily: Darwin
operatingsystem: Darwin

Chef has a similar tool called ohai

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.