如何获得Linux发行版的名称和版本? [英] How to get Linux distribution name and version?

查看:129
本文介绍了如何获得Linux发行版的名称和版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Windows读取注册表键 SOFTWARE \\微软\\的Windows NT \\ CURRENTVERSION \\名称来获得操作系统的全名和版本。

In Windows I read the registry key SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName to get the full name and version of the OS.

但在Linux中,code

But in Linux, the code

struct utsname ver;
uname(&ver);
retVal = ver.sysname;

返回字符串的Linux ,而不是 Ubuntu 9.04的

我怎样才能获得Linux发行版的名称和版本?

How can I get the Linux distribution name and version?

推荐答案

尝试:

cat /etc/lsb-release

您也可以尝试

lsb_release -a

或者

cat /proc/version

这篇关于如何获得Linux发行版的名称和版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆