如何通过命令行识别特定的 Linux 风格?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13036048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 17:35:12  来源:igfitidea点击:

How do I identify the particular Linux flavor via command line?

linuxversioncommand-line-interface

提问by mcandre

I'd like to be able to detect which particular Linux flavor is installed on a computer, e.g. Ubuntu vs Fedora, via a command line command.

我希望能够通过命令行命令检测计算机上安装了哪种特定的 Linux 风格,例如 Ubuntu 与 Fedora。

Some people recommend uname -a, but that only reports the kernel version.

有人推荐uname -a,但那只报告内核版本。

采纳答案by ramit girdhar

Try the below command.... It worked for me...

试试下面的命令......它对我有用......

cat /proc/version

猫/过程/版本

Once you know that you are running Red Hat for example, you can get to the point with:

例如,一旦您知道您正在运行 Red Hat,您可以通过以下方式进入正题:

cat /etc/redhat-release

cat /etc/redhat-release

Or on Debian:

或者在 Debian 上:

cat /etc/debian_version

cat /etc/debian_version

or in general :

或者一般来说:

cat /etc/*-release

cat /etc/*-release

Also you could use the following command

您也可以使用以下命令

cat /etc/issue

猫 /etc/issue

回答by Bhanu Kaushik

I hope this works echo $(lsb_release -si)

我希望这有效 echo $(lsb_release -si)

回答by Rag Sagar

For displaying details including release and codename of the distro

用于显示详细信息,包括发行版的发行版和代号

lsb_release -a