I'm trying to find a way to determine Linux distribution name and version that would work on most (or ideally, all) modern distributions. I noticed that /etc/os-release
contains the info I need on the distributions I tried (CentOS, Debian), but how safe is it to rely on the presence of it? Commands such as uname -a
don't really contain the same info, and lsb_release
is apparently not present on e.g. minimal CentOS.
Is there a quick way to find out exactly what distros come with /etc/os-release
? Moreover, is /etc/os-release
guaranteed to contain NAME
, VERSION
and PRETTY_NAME
fields?