For debian based system

cat /etc/*_version

or for a Red Hat based system

cat /etc/*-release