redhat - ghdrako/doc_snipets GitHub Wiki
Version
# redhat version
cat /etc/redhat-release
less /etc/os-release
less /etc/system-release-cpe
more /etc/issue
hostnamectl
rpm --query redhat-release-server
lsb_release -d
lsb_release -a
# kernel version
cat /proc/version
uname -a
uname -mrs
grep VERSION_ID /etc/os-release
ver=$(grep '^VERSION_ID' /etc/os-release | awk -F'=' '{ print $2}')
echo "$ver"
# replace double quotes #
ver=$(grep '^VERSION_ID' /etc/os-release | awk -F'=' ' gsub(/"/,"") { print $2}')
echo "$ver"
# We can use awk and avoid grep completely #
# 1. Search for VERSION_ID in /etc/os-release
# 2. Use '=' as a field seprator
# 3. Remove double quote
# 4. Print version number
# 5. Store the version number in $rhel_ver shell variable
rhel_ver=$(awk -F'=' '/VERSION_ID/{ gsub(/"/,""); print $2}' /etc/os-release)
echo "$rhel_ver"
Infra certs path
/etc/pki/ca-trust/source/anchors