Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check the Linux release name and version number

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to check Linux release name and version number". In daily operation, I believe many people have doubts about how to view Linux release name and version number. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "how to check Linux release name and version number". Next, please follow the editor to study!

Overview of methods

Lsb_release command

/ etc/*-release file

Uname command

/ proc/version file

Dmesg command

YUM or DNF command

RPM command

APT-GET command

Method 1: lsb_release command

LSB (Linux standard library Linux Standard Base) can print the specific information of the distribution, including the release name, version number, code, and so on.

# lsb_release-aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 16.04.3 LTSRelease: 16.04Codename: xenial method 2: / etc/*-release file

Release files are usually regarded as the identity of the operating system. There are many files in the / etc directory that record all kinds of information about the distribution, and each distribution has its own set of files that record the relevant information. The following is a set of file contents displayed on the Ubuntu/Debian system.

# cat / etc/issueUbuntu 16.04.3 LTS\ n\ l # cat / etc/issue.netUbuntu 16.04.3 LTS # cat / etc/lsb-releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=16.04DISTRIB_CODENAME=xenialDISTRIB_DESCRIPTION= "Ubuntu 16.04.3 LTS" # cat / etc/os-releaseNAME= "Ubuntu" VERSION= "16.04.3 LTS (Xenial Xerus)" ID=ubuntuID_LIKE=debianPRETTY_NAME= "Ubuntu 16.04.3 LTS" VERSION_ID= "16.04" HOME_URL= "http://www.ubuntu.com/"SUPPORT _ URL= "http://help.ubuntu.com/"BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"VERSION_CODENAME=xenialUBUNTU_CODENAME=xenial # cat / etc/debian_version9.3

The following set of files is displayed on the RHEL/CentOS/Fedora system. Where the / etc/redhat-release and / etc/system-release files are a connection to the / etc/ [release name]-release file.

# cat / etc/centos-releaseCentOS release 6.9 (Final) # cat / etc/fedora-releaseFedora release 27 (Twenty Seven) # cat / etc/os-releaseNAME=FedoraVERSION= "27 (Twenty Seven)" ID=fedoraVERSION_ID=27PRETTY_NAME= "Fedora 27 (Twenty Seven)" ANSI_COLOR= "0 34 "CPE_NAME=" cpe:/o:fedoraproject:fedora:27 "HOME_URL=" https://fedoraproject.org/"SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"BUG_REPORT_URL="https://bugzilla.redhat.com/"REDHAT_BUGZILLA_PRODUCT="Fedora"REDHAT_BUGZILLA_PRODUCT_VERSION=27REDHAT_SUPPORT_PRODUCT="Fedora"REDHAT_SUPPORT_PRODUCT_VERSION=27PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" # cat / etc/redhat-releaseFedora release 27 (Twenty Seven) # cat / etc/system-releaseFedora release 27 (Twenty Seven) method 3: uname command

Uname (unix name) is a tool for printing system information, including kernel name, version number, system details, operating system running, and so on.

Recommended reading: 6 ways to view the Linux kernel of a system

# uname-aLinux localhost.localdomain 4.12.14-300.fc26.x86_64 # 1 SMP Wed Sep 20 16:28:07 UTC 2017 x86 "64 GNU/Linux

The above running results show that the operating system version used is Fedora 26.

Method 4: / proc/version file

This file records the version of the Linux kernel, the version of the gcc used to compile the kernel, the time the kernel was compiled, and the user name of the kernel compiler.

# cat / proc/versionLinux version 4.12.14-300.fc26.x86_64 ([email protected]) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)) # 1 SMP Wed Sep 20 16:28:07 UTC 2017 method 5: dmesg command

Dmesg (presentation information display message or driver information driver message) is a command on most Unix-like operating systems to print information from the kernel's message buffer.

# dmesg | grep "Linux" [0.000000] Linux version 4.12.14-300.fc26.x86_64 ([email protected]) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)) # 1 SMP Wed Sep 20 16:28:07 UTC 2017 [0.001000] SELinux: Initializing. [0.001000] SELinux: Starting in permissive mode [0.470288] SELinux: Registering netfilter hooks [0.616351] Linux agpgart interface v0.103 [0.630063] Usb usb1: Manufacturer: Linux 4.12.14-300.fc26.x86_64 ehci_hcd [0.688949] usb usb2: Manufacturer: Linux 4.12.14-300.fc26.x86_64 ohci_hcd [2.564554] SELinux: Disabled at runtime. [2.564584] SELinux: Unregistering netfilter hooks method 6: Yum/Dnf command

Yum (Yellowdog updater modified Yellowdog Updater Modified) is a package management tool on the Linux operating system, and the yum command is used to install, update, find, and delete software packages on some RedHat-based Linux distributions.

Recommended reading: use the yum command to manage software packages on RHEL/CentOS systems

# yum info nanoLoaded plugins: fastestmirror, ovlLoading mirror speeds from cached hostfile * base: centos.zswap.net * extras: mirror2.evolution-host.com * updates: centos.zswap.netAvailable PackagesName: nanoArch: x86_64Version: 2.3.1Release: 10.el7Size: 440 kRepo: base/7/x86_64Summary: A small text editorURL: http://www.nano-editor.orgLicense: GPLv3+Description: GNU nano is a small and friendly text editor.

The execution of the following yum repolist command shows that yum's basic source warehouse, extra source warehouse, and update source warehouse all come from the CentOS 7 warehouse.

# yum repolistLoaded plugins: fastestmirror, ovlLoading mirror speeds from cached hostfile * base: centos.zswap.net * extras: mirror2.evolution-host.com * updates: centos.zswap.netrepo id repo name statusbase/7/x86_64 CentOS-7-Base 9591extras/7/x86_64 CentOS-7-Extras 388updates/7/x86_64 CentOS-7-Updates 1929repolist: 11908

You can also view the release name and version number using the dnf command.

Recommended reading: use the DNF (a branch of YUM) command to manage software packages on Fedora systems

# dnf info nanoLast metadata expiration check: 0:01:25 ago on Thu Feb 15 01:59:31 2018.Installed PackagesName: nanoVersion: 2.8.7Release: 1.fc27Arch: x86_64Size: 2.1 MSource: nano-2.8.7-1.fc27.src.rpmRepo: @ SystemFrom repo: fedoraSummary: A small text editorURL: https://www.nano-editor.orgLicense: GPLv3+Description: GNU nano is a small and friendly text editor. Method 7: RPM command

RPM (Red Hat Manager RedHat Package Manager) is a powerful command line package management tool on RedHat-based operating systems such as CentOS, Oracle Linux and Fedora. It can also help us to view the version information of the system.

Recommended reading: use RPM commands to manage software packages on RHEL-based systems

# rpm-Q nanonano-2.8.7-1.fc27.x86_64 method 8: APT-GET command

Apt-Get (Advanced Packaging tool Advanced Packaging Tool) is a powerful command-line tool that automatically downloads and installs new packages, updates existing packages, updates package list indexes, and even updates entire Debian systems.

Recommended reading: use Apt-Get and Apt-Cache commands to manage software packages on Debian-based systems

# apt-cache policy nanonano: Installed: 2.5.3-2ubuntu2 Candidate: 2.5.3-2ubuntu2 Version table: * 2.5.3-2ubuntu2 500 500 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages 100 / var/lib/dpkg/status 2.5.3-2 500 500 http://nova.clouds.archive.ubuntu.com/ubuntu xenial/main amd64 Packages this ends the study on "how to check the Linux release name and version number" I hope I can solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report