Monday, February 13, 2023

How to check Linux distribution and version

 

check Linux  distribution and version


[root@localhost ~]# cat /etc/os-release

NAME="Oracle Linux Server"

VERSION="7.8"

ID="ol"

ID_LIKE="fedora"

VARIANT="Server"

VARIANT_ID="server"

VERSION_ID="7.8"

PRETTY_NAME="Oracle Linux Server 7.8"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:oracle:linux:7:8:server"

HOME_URL="https://linux.oracle.com/"

BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"

ORACLE_BUGZILLA_PRODUCT_VERSION=7.8

ORACLE_SUPPORT_PRODUCT="Oracle Linux"

ORACLE_SUPPORT_PRODUCT_VERSION=7.8

[root@localhost ~]#



[root@localhost ~]# cat /etc/redhat-release

Red Hat Enterprise Linux Server release 7.8 (Maipo)

[root@localhost ~]#





[root@localhost ~]# cat /etc/oracle-release
Oracle Linux Server release 7.8
[root@localhost ~]#



check kernel version 


[root@localhost ~]# uname -r
4.14.35-1902.300.11.el7uek.x86_64
[root@localhost ~]#



To check Package is installed or not 


rpm -q package_name


rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" | grep package_name

[root@localhost ~]#
[root@localhost ~]# rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" | grep ssh 
openssh-server-7.4p1-21.0.1.el7 (x86_64)
openssh-7.4p1-21.0.1.el7 (x86_64)
openssh-clients-7.4p1-21.0.1.el7 (x86_64)
libssh2-1.8.0-3.el7 (x86_64)
[root@localhost ~]#



check multiple packages, and review the output for the validations


rpm -q binutils compat-libstdc++ gcc glibc libaio libgcc libstdc++ \
make sysstat unixodbc

[root@localhost ~]# rpm -q binutils compat-libstdc++ gcc glibc libaio libgcc libstdc++ \
> make sysstat unixodbc
binutils-2.27-43.base.0.1.el7.x86_64
package compat-libstdc++ is not installed
gcc-4.8.5-39.0.3.el7.x86_64
glibc-2.17-307.0.1.el7.1.x86_64
libaio-0.3.109-13.el7.x86_64
libgcc-4.8.5-39.0.3.el7.x86_64
libstdc++-4.8.5-39.0.3.el7.x86_64
make-3.82-24.el7.x86_64
sysstat-10.1.5-19.el7.x86_64
package unixodbc is not installed
[root@localhost ~]#

No comments:

Post a Comment