In Windows I read the registry key SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
to get the full name and version of the OS.
But in Linux, the code
struct utsname ver;
uname(&ver);
retVal = ver.sysname;
returns the string linux
, not Ubuntu 9.04
.
How can I get the Linux distribution name and version?
The uname and /etc/os-release commands are the most common methods for getting the version of Linux you're running and are available by default on any Linux system you run.
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system.
Try:
cat /etc/lsb-release
You can also try
lsb_release -a
Or:
cat /proc/version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With