如何查看当前系统版本的版本号

作为一名系统管理员,了解系统版本号是必然。因为不同大版本之间的命令和启动流程等之间有很大的差异;

    一、在/etc/system-release 里面查看

        ~]#ls -l /etc/system-release

        lrwxrwxrwx. 1 root root 14 Jul 19 19:37 /etc/system-release -> centos-release

        ~]#ls -l /etc/*-release

        -rw-r–r–. 1 root root  25 Jul 22 10:06 /etc/centos-release

        lrwxrwxrwx. 1 root root  14 Jul 19 19:37 /etc/redhat-release -> centos-release

        lrwxrwxrwx. 1 root root  14 Jul 19 19:37 /etc/system-release -> centos-release

       可以发现都是指向centos-release,所以任意打开其中一个即可

            ~]# cat /etc/system-release

              CentOS release 6.8 (Final)

        可以知道这个主机是CentOS 6.8

    二、可以用当lsb_release这个命令查看,但是这个命令需要单独安装。在yum自行安装即可

                ~]# lsb_release -a

            LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch

            Distributor ID: CentOS

            Description: CentOS Linux release 7.2.1511 (Core) 

            Release: 7.2.1511

            Codename: Core

          可以知道这个主机是CentOS 7.2

    三、假若你对对内核版本熟悉,同样通过内核的版本号得知当前CentOS的版本号

             ~]# uname -r

            3.10.0-327.el7.x86_64

     可以通过内核的版本号得知当前系统版本号,这是CentOS 7 以上的版本。知道这里即可,因为命令差异是在大的版本上,如CentOS 6 系列和CentOS 7系列,相同大版本的之间差异不大。

原创文章,作者:fighter,如若转载,请注明出处:http://www.178linux.com/25270

赞 (1)
fighterfighter
上一篇 2016-07-29 15:27
下一篇 2016-07-29 15:27

相关推荐

  • 运维工程师技能需求排行

    这是我今天在拉勾网搜索运维,翻完了4四页也招聘信息之后得到的,我的目的是想要看看之后的学习,哪个更应该成为重点,有些在我意料之中,有些还真的没想到,算是努力了一个小时的收获吧,分享给大家。
    注意:其中的看法仅代表个人观点,很多都是依靠我自己的学习经验和工作经验累积的

    Linux干货 2017-12-12
  • 马哥教育网络班N22期+第9周课程练习

    1、写一个脚本,判断当前系统上所有用户的shell是否为可登录shell(即用户的shell不是/sbin/nologin);分别这两类用户的个数;通过字符串比较来实现; #!/bin/bashnolo_user=0login_user=0while read user;do    bash_type=$(e…

    Linux干货 2016-10-21
  • N22-妙手-第四周博客作业

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 [root@localhost ~]# cp -r /etc/skel /home/tuser1 [root@localhost ~]# chmod&nb…

    Linux干货 2016-09-05
  • Centos7 PHP-FPM源码安装

    PHP-FPM源码安装 安装必要组件 yum install -y openssl-devel traceroute libtool unzip gcc gcc-c++ autoconf net-snmp-devel vim wget sysstat lrzsz  man tree mysql-devel ntpdate rsync libxml2…

    系统运维 2016-09-06
  • man的用法

    man的使用 man命令是Linux下的帮助指令,通过man指令可以查看Linux中的指令帮助、配置文件帮助和编程帮助等信息。 语法 man(选项)(参数) 选项 -a:在所有的man帮助手册中搜索; -f:等价于whatis指令,显示给定关键字的简短描述信息; -P:指定内容时使用分页程序; -M:指定man手册搜索的路径。 参数 数字:指定从哪本man手…

    Linux干货 2018-03-04
  • centos启动流程

    1、centos启动流程 简单流程简介: POST –> Boot Sequence(BIOS) –> Boot Loader (MBR) –> Kernel(ramdisk) –> rootfs –> switchroot –> /sbin/init…

    Linux干货 2016-09-09