Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavin-romig-koch/5b4ee307a4d038c66d89a6ca2aa08d92 to your computer and use it in GitHub Desktop.
Save gavin-romig-koch/5b4ee307a4d038c66d89a6ca2aa08d92 to your computer and use it in GitHub Desktop.
What version of RHEL?
If you know you are on RHEL or Centos what are the ways to determine
which version you are on?
Well it depends upon why you want to know. Most reciently i wanted to automatically
choose the correct version of EPEL to install. I chose to use
yum version | grep '^Installed: ' | sed -e 's!^Installed:[ \t]\+\([^ \t/]\).*$!\1!'
other possibilities, instead of yum were:
rpm -q --queryformat '%{VERSION}' -f /etc/redhat-release
rpm -q --queryformat '%{VERSION}' --whatprovides redhat-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment