How to check OS and version using a Linux ?

For debian based system

cat /etc/*_version

or for a Red Hat based system

cat /etc/*-release