본문 바로가기

Computer Science/Linux

[linux] 리눅스 종류 및 버전 확인 - 대부분의 리눅스에서 사용가능

반응형

방법 1. OS에 관련된 릴리즈 정보를 모두 출력한 뒤 unique한 row만 남기는 방식으로 출력한다.

cat /etc/*-release | uniq

 

방법 2. grep을 활용하여 검색

grep . /etc/*-release

 

실행예시 (Ubuntu 14.04.3)

root@zetawiki:~# grep . /etc/*-release
/etc/lsb-release:DISTRIB_ID=Ubuntu
/etc/lsb-release:DISTRIB_RELEASE=14.04
/etc/lsb-release:DISTRIB_CODENAME=trusty
/etc/lsb-release:DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
/etc/os-release:NAME="Ubuntu"
/etc/os-release:VERSION="14.04.3 LTS, Trusty Tahr"
/etc/os-release:ID=ubuntu
/etc/os-release:ID_LIKE=debian
/etc/os-release:PRETTY_NAME="Ubuntu 14.04.3 LTS"
/etc/os-release:VERSION_ID="14.04"
/etc/os-release:HOME_URL="http://www.ubuntu.com/"
/etc/os-release:SUPPORT_URL="http://help.ubuntu.com/"
/etc/os-release:BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

 

실행예시 (CentOS 6.5)

[root@zetawiki ~]# grep . /etc/*-release
/etc/centos-release:CentOS release 6.5 (Final)
/etc/lsb-release:LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
/etc/redhat-release:CentOS release 6.5 (Final)
/etc/system-release:CentOS release 6.5 (Final)

 

실행예시 (Fedora 11 Leonidas)

[root@zetawiki ~]# cat /etc/*-release | uniq
Fedora release 11 (Leonidas)

 

실행예시 (Oracle Enterprise Linux Server 5.5)

[root@zetawiki ~]# cat /etc/*-release | uniq
Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

 

실행예시 (SUSE Linux Enterprise Server 11)

zetawiki:~ # cat /etc/*-release | uniq
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 1
LSB_VERSION="core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64"

 

반응형