Finding system information in Linux

Written by Robert -

There are several ways to find information on your system.

Let's start with a common tool to find out what kernel you are running and some other information. This tool is called uname. uname is a common tool within Linux to view simple data. the most common option is the -a which shows "all" information within uname.

Here is the output of one of my systems:

$ uname -a
Linux <hostname> 3.0.76-0.11-default #1 SMP Fri Jun 14 08:21:43 UTC 2013 (ccab990) x86_64 x86_64 x86_64 GNU/Linux


As you can see the device is a Linux server. It also shows that this server is running the 3.0.76 kernel build in 2013 and that it's a 64 bit GNU/Linux system. Now this is nice to know, but it doesn't show all of the items you might wish to know.

If you manage a lot of different servers it can also be nice to know what version of Linux it's running. Different Linux systems have a different name for the file which contains this information, but they all end in release. Because of this, you can use the cat (concatenate) command to read the output of the file.

$ cat /etc/*release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 3


Another tool is lspci, which shows all the PCI devices attached to your computer. Here is small sample of the output:

00:05.4 PIC: Intel Corporation Ivytown IOAPIC (rev 04)
00:11.0 PCI bridge: Intel Corporation C600/X79 series chipset PCI Express Virtual Root Port (rev 05)
00:1a.0 USB controller: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller #2 (rev 05)
00:1c.0 PCI bridge: Intel Corporation C600/X79 series chipset PCI Express Root Port 1 (rev b5)
00:1c.7 PCI bridge: Intel Corporation C600/X79 series chipset PCI Express Root Port 8 (rev b5)
00:1d.0 USB controller: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller #1 (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation C600/X79 series chipset LPC Controller (rev 05)
00:1f.2 IDE interface: Intel Corporation C600/X79 series chipset 4-Port SATA IDE Controller (rev 05)
01:00.0 System peripheral: Hewlett-Packard Company Integrated Lights-Out Standard Slave Instrumentation & System Support (rev 05)
01:00.1 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200EH
01:00.2 System peripheral: Hewlett-Packard Company Integrated Lights-Out Standard Management Processor Support and Messaging (rev 05)
01:00.4 USB controller: Hewlett-Packard Company Integrated Lights-Out Standard Virtual USB Controller (rev 02)
02:00.0 RAID bus controller: Hewlett-Packard Company Smart Array Gen8 Controllers (rev 01)
03:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)
03:00.1 Ethernet controller: Broadcom Corporation NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)


To find USB devices you can use the corresponding lsusb:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 003: ID 0424:2660 Standard Microsystems Corp.


If you wish to know more about the CPU in the device, there is, not surprising, the lscpu:

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                20
On-line CPU(s) list:   0-19
Thread(s) per core:    1
Core(s) per socket:    10
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Stepping:              4
CPU MHz:               3000.000
BogoMIPS:              5985.44
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              25600K
NUMA node0 CPU(s):     0-9
NUMA node1 CPU(s):     10-19


You can see this is a 64 bit CPU. You can also see that this machine has two physical CPU's with 10 cores per socket. You can also see the GHz the processors are running at and the cache.

If you want a full hardware report you can run hwinfo but this tool generates a LOT of data. If I have to run this to find information I usually output the information to a file and then use cat with grep to search for the information.

To find SCSI devices you can use lsscsi:

$ lsscsi
[0:0:0:0]    disk    HP       LOGICAL VOLUME   4.68  /dev/sda
[0:3:0:0]    storage HP       P420i            4.68  -
[2:0:0:0]    cd/dvd  hp       DVDRAM GT80N     EA02  /dev/sr0


But I prefer to find drives with lsblk or fdisk.

$ lsblk
NAME                              MAJ:MIN RM   SIZE RO MOUNTPOINT
sda                                 8:0    0   7.7T  0
├─sda1                              8:1    0   128G  0 [SWAP]
├─sda2                              8:2    0   200G  0 /
├─sda3                              8:3    0   203M  0 /boot
└─sda4                              8:4    0   7.3T  0
  ├─vgroot-data (dm-0)            253:0    0     1T  0 /data
  ├─vgroot-dumps (dm-1)           253:1    0   500G  0 /dumps
  └─vgroot-lvm (dm-2) 253:2    0     1T  0 /lvm
sr0                                11:0    1  1024M  0


Here is an fdisk output (-l is list current disks):

$ fdisk -l
Disk /dev/sda: 8401.5 GB, 8401467301888 bytes
255 heads, 63 sectors/track, 1021420 cylinders, total 16409115824 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 1835008 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            3584   268445183   134220800   82  Linux swap / Solaris
/dev/sda2       268445184   687887871   209721344   83  Linux
/dev/sda3   *   687887872   688303615      207872   83  Linux
/dev/sda4               1           1           0+  ee  GPT

Disk /dev/mapper/vgroot-data: 1099.5 GB, 1099511627776 bytes
255 heads, 63 sectors/track, 133674 cylinders, total 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 1835008 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vgroot-dumps: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders, total 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 1835008 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vgroot-lvm: 1099.5 GB, 1099511627776 bytes
255 heads, 63 sectors/track, 133674 cylinders, total 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 1835008 bytes
Disk identifier: 0x00000000


For drive information it might be helpful to use the df (disk free) with the human readable option to check if a drive is getting filled up:

 df -h
Filesystem                          Size  Used Avail Use% Mounted on
/dev/sda2                           197G  9.2G  178G   5% /
udev                                 64G  184K   64G   1% /dev
tmpfs                                64G     0   64G   0% /dev/shm
/dev/sda3                           197M   39M  149M  21% /boot
/dev/mapper/vgroot-data             1.0T   96G  928G  10% /data
/dev/mapper/vgroot-dumps            500G   27G  474G   6% /dumps
/dev/mapper/vgroot-lvm  1.0T  240G  784G  24% /lvm


To view the RAM status you can either use the command "free -m" or check top for active data:

free -m:

$ free -m
             total       used       free     shared    buffers     cached
Mem:        129161     128765        395          0        145      83058
-/+ buffers/cache:      45562      83598
Swap:       131074        227     130847


$ top
top - 17:27:38 up 34 days,  4:00,  1 user,  load average: 0.16, 0.26, 0.30
Tasks: 245 total,   1 running, 244 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.1%us,  0.2%sy,  0.0%ni, 98.6%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    129161M total,   128763M used,      397M free,      145M buffers
Swap:   131074M total,      227M used,   130847M free,    83058M cached


There are a lot of readable files within the /proc folder that can show you system information. You can for example use 'cat /proc/cpuinfo' for more information about your CPU.

If you still haven't found the information you are looking for, there is always dmidecode.

Comments

Written by Randy -

Hi, My name is Randy and I was looking at a few different sites online and came across your site arawn.org. I must say - your website is very impressive.
Written by Randy -

Hi, My name is Randy and I was looking at a few different sites online and came across your site arawn.org. I must say - your website is very impressive. Thanks and Best Regards, Randy
Written by Randy -

Hi, My name is Randy and I was looking at a few different sites online and came across your site arawn.org. I must say - your website is very impressive.
Written by Hannah Martin -

Found your site today and I liked how good it looked.
Written by Hannah Wilson -

Hey nice site.