简体   繁体   中英

Check Which operating system is installed ( CentOS, Ubuntu, Redhat, ... etc)

I have been given a server with OS installed. I want to check which Operating system is installed in it. I have used uname -a with ouput of Linux ctl 2.6.32-573.3.1.el6.x86_64 #1 SMP Mon Aug 10 09:44:54 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

Any suggestions ?

You could use the /etc/os-release file, which contains information on the os using the freedesktop spec.

Printing out just the OS name and version:

awk -F '=' '/PRETTY_NAME/ { print $2 }' /etc/os-release

on many OS's, you can get the os via:

lsb_release -d

The el6 in the kernel version could indicate a RedHat (thus Fedora as well), Oracle, Centos, Scientific Linux. Potentially others as well.

At least on some of these systems (others as well) the distribution can be identified from the /etc/issue* files. For example:

> ls -la /etc/issue*
-rw-r--r-- 1 root root 57 Oct 22  2014 /etc/issue
-rw-r--r-- 1 root root 55 Oct 22  2014 /etc/issue.net
> cat /etc/issue
Welcome to openSUSE 13.2 "Harlequin" - Kernel \r (\l).

您可以尝试使用以下命令来检查与操作系统版本有关的所有详细信息:

cat /etc/*elease

如果已安装,则解析 gcc 的版本信息: gcc --version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM