1. uname 命令 uname(unix name) 是一个打印系统信息的工具,包括内核名称、版本号、系统详细信息以及所运行的操作系统等等。 - root@test-01 ~ >> uname -a
- Linux test-01 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
复制代码 2. /proc/version 文件这个文件记录了 Linux 内核的版本、用于编译内核的 gcc 的版本、内核编译的时间,以及内核编译者的用户名。 - root@test-01 ~ >> cat /proc/version
- Linux version 3.10.0-693.21.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Wed Mar 7 19:03:37 UTC 2018
复制代码 3. RPM 命令RPM(红帽包管理器 [ RedHat Package Manager ])是在 CentOS、Oracle Linux、Fedora 这些基于 RedHat 的操作系统上的一个强大的命令行包管理工具,同样也可以帮助我们查看系统的版本信息。 - root@test-01 ~ >> rpm -q kernel
- kernel-3.10.0-514.el7.x86_64
- kernel-3.10.0-693.21.1.el7.x86_64
复制代码 4. /boot/ 文件夹/boot 文件夹包含所有引导相关的信息文件和文件夹,例如 grub.conf,vmlinuz image aka kernel 等。 - root@test-01 ~ >> ll /boot/ | grep vmlinuz
- -rwxr-xr-x. 1 root root 5.2M 11月 23 2016 vmlinuz-3.10.0-514.el7.x86_64
- -rwxr-xr-x. 1 root root 5.7M 3月 8 03:16 vmlinuz-3.10.0-693.21.1.el7.x86_64
复制代码 5. dmesg 命令dmesg(展示信息 [ display message ] 或驱动程序信息 [ driver message ])是大多数类 Unix 操作系统上的一个命令,用于打印内核的消息缓冲区的信息。 - root@test-01 ~ >> dmesg | grep Linux
- [ 0.000000] Linux version 3.10.0-693.21.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Wed Mar 7 19:03:37 UTC 2018
- [ 2.644215] Linux agpgart interface v0.103
- [ 2.658447] usb usb1: Manufacturer: Linux 3.10.0-693.21.1.el7.x86_64 ehci_hcd
- [ 2.662139] usb usb2: Manufacturer: Linux 3.10.0-693.21.1.el7.x86_64 uhci_hcd
复制代码 5. Yum/Dnf 命令Yum(Yellowdog 更新器修改版 [ Yellowdog Updater Modified ])是 Linux 操作系统上的一个包管理工具,而 yum 命令被用于一些基于 RedHat 的 Linux 发行版上安装、更新、查找、删除软件包。 - root@test-01 ~ >> yum info kernel
- Installed Packages
- Name : kernel
- Arch : x86_64
- Version : 3.10.0
- Release : 514.el7
- Size : 148 M
- Repo : installed
- From repo : anaconda
- Summary : The Linux kernel
- URL : http://www.kernel.org/
- License : GPLv2
- Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
- : Linux operating system. The kernel handles the basic functions
- : of the operating system: memory allocation, process allocation, device
- : input and output, etc.
- Name : kernel
- Arch : x86_64
- Version : 3.10.0
- Release : 693.21.1.el7
- Size : 60 M
- Repo : installed
- From repo : updates
- Summary : The Linux kernel
- URL : http://www.kernel.org/
- License : GPLv2
- Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
- : Linux operating system. The kernel handles the basic functions
- : of the operating system: memory allocation, process allocation, device
- : input and output, etc.
- root@test-01 ~ >> dnf info kernel
- Installed Packages
- Name : kernel
- Arch : x86_64
- Epoch : 0
- Version : 3.10.0
- Release : 514.el7
- Size : 148 M
- Repo : @System
- Summary : The Linux kernel
- URL : http://www.kernel.org/
- License : GPLv2
- Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
- : Linux operating system. The kernel handles the basic functions
- : of the operating system: memory allocation, process allocation, device
- : input and output, etc.
- Name : kernel
- Arch : x86_64
- Epoch : 0
- Version : 3.10.0
- Release : 693.21.1.el7
- Size : 60 M
- Repo : @System
- Summary : The Linux kernel
- URL : http://www.kernel.org/
- License : GPLv2
- Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
- : Linux operating system. The kernel handles the basic functions
- : of the operating system: memory allocation, process allocation, device
- : input and output, etc.
- Available Packages
- Name : kernel-debug
- Arch : x86_64
- Epoch : 0
- Version : 3.10.0
- Release : 693.21.1.el7
- Size : 45 M
- Repo : updates
- Summary : The Linux kernel compiled with extra debugging enabled
- URL : http://www.kernel.org/
- License : GPLv2
- Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
- : Linux operating system. The kernel handles the basic functions
- : of the operating system: memory allocation, process allocation, device
- : input and output, etc.
- :
- : This variant of the kernel has numerous debugging options enabled.
- : It should only be installed when trying to gather additional information
- : on kernel bugs, as some of these options impact performance noticably.
复制代码 6. lsb_release 命令(此命令适用于所有的 Linux 发行版本)LSB(Linux 标准库 [ Linux Standard Base ])能够打印发行版的具体信息,包括发行版名称、版本号、代号等。 如没有此命令可运行 yum install redhat-lsb-core 安装 - root@test-01 ~ >> lsb_release -a
- LSB Version: :core-4.1-amd64:core-4.1-noarch
- Distributor ID: CentOS
- Description: CentOS Linux release 7.4.1708 (Core)
- Release: 7.4.1708
- Codename: Core
复制代码 7. /etc/*release 文件release 文件通常被视为操作系统的标识。在 /etc 目录下放置了很多记录着发行版各种信息的文件,每个发行版都各自有一套这样记录着相关信息的文件。 - root@test-01 ~ >> ll /etc/*release
- -rw-r--r--. 1 root root 38 Aug 30 2017 /etc/centos-release
- -rw-r--r--. 1 root root 393 Aug 30 2017 /etc/os-release
- lrwxrwxrwx. 1 root root 14 Mar 23 12:45 /etc/redhat-release -> centos-release
- lrwxrwxrwx. 1 root root 14 Mar 23 12:45 /etc/system-release -> centos-release
- root@test-01 ~ >> cat /etc/os-release
- NAME="CentOS Linux"
- VERSION="7 (Core)"
- ID="centos"
- ID_LIKE="rhel fedora"
- VERSION_ID="7"
- PRETTY_NAME="CentOS Linux 7 (Core)"
- ANSI_COLOR="0;31"
- CPE_NAME="cpe:/o:centos:centos:7"
- HOME_URL="https://www.centos.org/"
- BUG_REPORT_URL="https://bugs.centos.org/"
- CENTOS_MANTISBT_PROJECT="CentOS-7"
- CENTOS_MANTISBT_PROJECT_VERSION="7"
- REDHAT_SUPPORT_PRODUCT="centos"
- REDHAT_SUPPORT_PRODUCT_VERSION="7"
- root@test-01 ~ >> cat /etc/centos-release
- CentOS Linux release 7.4.1708 (Core)
复制代码 8. /etc/issue | /etc/issue.net 文件(此命令适用于所有的 Linux 发行版本)- root@test-01 ~ >> cat /etc/issue
- CentOS release 6.6 (Final)
- Kernel \r on an \m
- root@test-01 ~ >> cat /etc/issue.net
- CentOS release 6.6 (Final)
- Kernel \r on an \m
复制代码
|