这是什么linux发行版?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了这是什么linux发行版?相关的知识,希望对你有一定的参考价值。

From http://www.novell.com/coolsolutions/feature/11251.html
  1. try this:
  2. cat /etc/issue
  3.  
  4. or run this:
  5. #!/bin/sh
  6. # Detects which OS and if it is Linux then it will detect which Linux Distribution.
  7.  
  8. OS=`uname -s`
  9. REV=`uname -r`
  10. MACH=`uname -m`
  11.  
  12. GetVersionFromFile()
  13. {
  14. VERSION=`cat $1 | tr " " ' ' | sed s/.*VERSION.*= // `
  15. }
  16.  
  17. if [ "${OS}" = "SunOS" ] ; then
  18. OS=Solaris
  19. ARCH=`uname -p`
  20. OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
  21. elif [ "${OS}" = "AIX" ] ; then
  22. OSSTR="${OS} `oslevel` (`oslevel -r`)"
  23. elif [ "${OS}" = "Linux" ] ; then
  24. KERNEL=`uname -r`
  25. if [ -f /etc/redhat-release ] ; then
  26. DIST='RedHat'
  27. PSUEDONAME=`cat /etc/redhat-release | sed s/.*(// | sed s/)//`
  28. REV=`cat /etc/redhat-release | sed s/.*release // | sed s/ .*//`
  29. elif [ -f /etc/SuSE-release ] ; then
  30. DIST=`cat /etc/SuSE-release | tr " " ' '| sed s/VERSION.*//`
  31. REV=`cat /etc/SuSE-release | tr " " ' ' | sed s/.*= //`
  32. elif [ -f /etc/mandrake-release ] ; then
  33. DIST='Mandrake'
  34. PSUEDONAME=`cat /etc/mandrake-release | sed s/.*(// | sed s/)//`
  35. REV=`cat /etc/mandrake-release | sed s/.*release // | sed s/ .*//`
  36. elif [ -f /etc/debian_version ] ; then
  37. DIST="Debian `cat /etc/debian_version`"
  38. REV=""
  39.  
  40. fi
  41. if [ -f /etc/UnitedLinux-release ] ; then
  42. DIST="${DIST}[`cat /etc/UnitedLinux-release | tr " " ' ' | sed s/VERSION.*//`]"
  43. fi
  44.  
  45. OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})"
  46.  
  47. fi
  48.  
  49.  
  50. echo ${OSSTR}

以上是关于这是什么linux发行版?的主要内容,如果未能解决你的问题,请参考以下文章

各发行版Linux介绍

各发行版Linux介绍

linux发行版的软件包安装管理程序

linux版本的发行版和内核版是啥意思

什么是Linux发行版?常见Linux发行版本有哪些?

用于嵌入式计算的流行Linux发行版