有没有办法找出使用哪个Linux发行版?

Lot*_*har 3 linux installation

我想向用户展示我在表单程序中的特定操作方面的一些帮助:

请输入"apt-get install foobar"来安装foobar功能.

有什么可以做到这一点,或者我必须留给用户,并提供红帽,Suse,Debian/Ubuntu,Mandriva,Slackware,Gentoo的dozend选择....

pie*_*fou 6

cat/etc/lsb-release

root@pierr-desktop:~# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
DISTRIB_CODENAME=intrepid
DISTRIB_DESCRIPTION="Ubuntu 8.10"
Run Code Online (Sandbox Code Playgroud)

  • 不要直接读取该文件,而是使用`lsb_release -a`(或具体请求您想要的属性,例如`lsb_release -i -r -c -d`). (2认同)

小智 5

lsb_release -a可能有助于debian和植物.

  • 在Debian上,除非安装了`lsb-release`包,否则它不存在.该包装没有标记为"必需",并不保证存在. (2认同)