There is the old method cat /etc/*-release
to match distribution release file.
For example on openSUSE this will match with /etc/SuSE-release
.
This method is deprecated and will be removed in the future.
There is a more modern and more universal method cat /etc/os-release
.
There is also a command with a more concise output lsb_release -a
.
To know the kernel version there is the uname command:
uname -a
to have all information
uname -rs
to have kernel name and version only
uname -m
to have architecture type
An alternative method is to see the /proc/version
file that is showing kernel version and gcc version used to build it.