How to get system information on RHEL/CentOS

Red hat

To fine tune a Red Hat Enterprise Linux system, we need to get the accurate picture of the running system. Fortunately ,by default Red hat comes with pretty detailed and handy way to get these information without even installing any additional software.

OS version

Firstly, To get the information about the operating system run the following command:

cat /etc/*release*

Resulting output will be something like this:

REDhar version

Most of system information is stored on the proc directory in Red Hat Linux. Some prominent ones are uptime, cpuinfo, meminfo,and version.

The following command shows information about the Linux Kernel version. A sample output could look like this:

[root@localhost ~]# cat /proc/version
Linux version 3.10.0-514.2.2.el7.x86_64 ( (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Dec 6 23:06:41 UTC 2016

In the output, first portion shows the specific version of the kernel, secord part shows which version of GNU Compiler Collection (GCC) is used to compile this kernel. At the end it shows the kernel compiler’s name in the parenthesis which is Red Hat in this case.

Processor information

Next command is to get information about processors running in the system.

[root@localhost ~]# cat /proc/cpuinfo

processor      : 0
vendor_id      : GenuineIntel
cpu family     : 6
model          : 58
model name     : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping       : 9
microcode      : 0x19
cpu MHz        : 2494.316
cache size     : 3072 KB
physical id    : 0
siblings       : 1
core id        : 0
cpu cores      : 1
apicid         : 0
initial apicid : 0
fpu            : yes
fpu_exception  : yes
cpuid level    : 13
wp             : yes
flags          : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx rdrand hypervisor lahf_lm
bogomips       : 4988.63
clflush size   : 64
cache_alignment: 64
address sizes  : 36 bits physical, 48 bits virtual
power management:

In the output, first line is the processor identifying number. Each processor present in the system will have its own processor number. So if a system has four cpu, we will see four set of above data listed one after another.

Next it also shows other informations like processor vendor and cpu family the processor belongs to.CPU family number comes really handy when dealing with rpm packages. Because when it comes to older Intel architectures like 386, 486 or 586 , rpm packages are created specifically for each of these systems. So an user can determine which rpm package version to install from this information.

cpu MHz — Shows the exact speed in terms of megahertz for the processor up to the thousandths decimal place. Next in the list is cache size , which displays the amount of level 2 memory cache available to the processor. When using hyper‐threading, siblings information displays the total number of sibling CPUs on the same physical CPU.

we can also check whether the cpu supports virtualization on this machine. In the flag option it will show vmx (in Intel based machine) or svm (in AMD based machine) if support for virtualisation exists.

Processor number: This command can also be run with various options to extract more precise information. For example,using grep with with this command we can determine actual number of cores running in the system. Following output is from a quad-core system.

[root@server]$ cat /proc/cpuinfo | grep 'core id'
core id : 0
core id : 1
core id : 2
core id : 3

If we want to get detailed information about the processors in REDhat system, we will use “lscpu” command.

[root@server ~]$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 63
Model name:            Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
Stepping:              2
CPU MHz:               2399.996
BogoMIPS:              4799.99
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
NUMA node0 CPU(s):     0-3

Memory information on RED Hat system:

The command to get memory information of REDhat operating system is cat /proc/meminfo

This command shows a lot of useful information about system ram. This is one of the most used file in the proc directory.

[root@server ~]$ cat /proc/meminfo
MemTotal:       12137828 kB
MemFree:        10702732 kB
MemAvailable:   10664928 kB
Buffers:             116 kB
Cached:           264824 kB
SwapCached:            0 kB
Active:          1048144 kB
Inactive:         188916 kB
Active(anon):     972724 kB
Inactive(anon):    75444 kB
Active(file):      75420 kB
Inactive(file):   113472 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                52 kB
Writeback:             0 kB
AnonPages:        972116 kB
Mapped:            87472 kB
Shmem:             76052 kB
Slab:              64264 kB
SReclaimable:      21948 kB
SUnreclaim:        42316 kB
KernelStack:        3136 kB
PageTables:        27392 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     6068912 kB
Committed_AS:    2251636 kB
VmallocTotal 34359738367 kB
VmallocUsed:       35528 kB
VmallocChunk 34359695100 kB
HardwareCorrupted:     0 kB
AnonHugePages:    772096 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      102968 kB
DirectMap2M:     3041280 kB
DirectMap1G:    11534336 kB

cat /proc/uptime

This command shows how long the a REDhat server is running since the last restart. sample Output :

 520634.58 274932.45

The first number represents the total number of seconds the system has been up. The second value is the sum of how much time each core has spent idle, in seconds. A full description of all the files in “proc” directory is available in Red Hat’s official access portal.

Leave a comment

Your email address will not be published. Required fields are marked *