Linux distribution name version

How to get Linux distribution name and version?

You might want to edit the title to make it clear the question is about doing it from C source, not as a script writer or user at the command line.

@Kolob Those were most emphatically not «more sensible» for this question; I have rolled back your change.

9 Answers 9

+1 this finally was «standardized» among the distro’s. Go back far enough though and this file doesn’t exist, instead each distro put their own file like /etc/redhat-release.

This will only work on LSB compliant Linux distributions, but is not guaranteed to work on non-compliant distributions. OTOH, it will also work on other LSB compliant non-Linux Unices. E.g. I’m pretty sure it won’t work on Adroid.

Note that on e.g. Gentoo Linux lsb_release is not always present by default. I just checked, and it’s provided by an optional package sys-apps/lsb-release, currently not installed on my system.

Will lsb-release works on all the follow Distrubtions?: Debian / Ubuntu | Red Hat Enterprise / Fedora Linux / Suse Linux / Cent OS ?

on my system yields the following from the bash (terminal) prompt:

Ubuntu 10.04.4 LTS 2.6.32-41-generic x86_64 

I believe uname -mr returns the version of the Linux Kernel, so ‘lsb_release -ds’ should be all you need for the release name and version, assuming the description format is consistent across releases. Thanks, I was wondering how you were supposed to use the short parameter, I was trying it ‘lsb_release -s’ and was wondering why it was failing. Cheers!

trying this way is an interesting one and less restrictive than lsb-release.

This is the best answer, to only retrieve the name of the distro one can do: cat /etc/*-release | grep ID | head -n1 | cut -d ‘=’ -f2

What’s the purpose of getting that information?

If you’re trying to detect some features or properties of the system (e.g. does it support some syscall or does it have some library), instead of relying on output of lsb_release you should either:

  • try to use given features and fail gracefully (e.g. dlopen for libraries, syscall(2) for syscalls and so on)
  • make it a part of your ./configure check if applicable (standard FOSS way of automatically recognizing system features/properties)

Note that the first way above applies even if your software is binary-only.

 dl = dlopen(module_path, RTLD_LAZY); if (!dl) < fprintf(stderr, "Failed to open module: %s\n", module_path); return; >funcptr = dlsym(dl, module_function); if (!funcptr) < fprintf(stderr, "Failed to find symbol: %s\n", module_function); return; >funcptr(); dlclose(dl); 

Источник

How to find Linux distribution name and Version?

While you are working on new Linux distribution, you might not know which Linux version is installed on your system. Sometimes, you need to meet a few system requirements while running an application on your system. However, different ways are available to check the Version of installed Linux distribution. Linux Mint 20 is the most growing Linux distribution and has a number of available graphical user interfaces that may vary from one user to the other. Hence, each user may also have a different running procedure. For this purpose, the recommended solution is to access and open the terminal command-line application.

Читайте также:  Linux mint usb windows 10

In this article, we will learn how to check the installed Linux distribution name and Version on Linux Mint 20.

Pre-requisites

You must have ‘sudo’ privileges or log in from the root user account on your system.

Check name and Version on Linux Mint 20

You can check the name and installed Linux distribution version using the following two different ways:

  • Check name and Version in Linux Mint 20 through the command line
  • Check Version using a graphical user interface method in Linux Mint 20

Let’s discuss each method one by one in detail.

Method 1: Check name and Version in Linux Mint 20 through the command line

Some users prefer to use the command line instead of the graphical user interface in Linux systems. Hence, using the command line, you have more options to get details about the installed Linux Mint distribution. To check the name and version of the Linux system on Linux Mint 20 environment, you need to follow the following different steps:

To open the terminal application, just log in to your Linux Mint 20 system and then click on the terminal icon that will be displayed on the taskbar.

Or you can pick the terminal by accessing the main menu. You can see the below-given screenshot, which is highlighted red:

In Linux distribution, specifically for Linux Mint 20, there are a lot of various utilities and text files present, which may help you to find the Linux Mint version. You can search the file that contains more information about the installed Linux Mint version, and that is available for all Debian based Linux/GNU distributions. This file you can find at etc/issue. Run the below-mentioned command on the terminal that will display the installed Linux Mint version:

After executing the above command, the following output will show on the terminal:

Display installed Version Using hostnamectl utility:

The most common utility or command that is available for almost all Linux systems is ‘hostnamectl.’ It displays detailed information about the currently running operating system. To display the installed version of Linux distribution using ‘hostnamectl’ utility, follow the appended method:

Type the following command on the terminal to display the information about the installed Linux Mint version:

The above command will display the complete information about the currently used operating environment and loaded kernel version. The following details about the installed Linux system to be displayed on the terminal:

The one, more file option ‘/etc/linuxmint/info,’ is available on the Linux Mint 20 distribution that keeps the details about the kernel and installed Version. Execute the following command on the terminal to view the kernel details:

The following output should display on the terminal window:

One more popular command which is available on Linux Mint is the ‘lsb_release’ command that provides much flexibility to select which piece of information is important for you to include in the Version checking task. To reveal the information about the released Version, distributor details, and codename, then you need to execute the following command:

Читайте также:  Steam sims 4 linux

After executing the above command, you will achieve the following information on the terminal window:

Type the following command to view the information about Linux Mint:

The following installed distribution details will display on the terminal screen:

Or you can also execute the following command to check the installed version of Linux Mint on your system:

You will see the following detailed information about the Linux Mint version:

Method 2: Check version using the graphical user interface method in Linux Mint 20

As we have discussed above, various Desktop environment managers are available for all Linux Mint distributions. So, you need to follow the following steps to check the installed Linux Mint version for Cinnamon Desktop.

  • Click on the start menu, the following application list menu will display on the system.
  • Click on the ‘system settings’ icon from the list, which is also highlighted in the below-given screenshot.

  • Once you click on the system settings, the following window will display your system where you will see the different management applications. Scroll the mouse cursor on the displayed window and click on the ‘system info’ icon as follows:

The following window will display on your system:

From the above screenshot, you can get the details about the currently installed operating system, cinnamon version, Linux kernel, and other system resources like processor, memory, hard drive, and graphics card.

Conclusion

From the above article, we have learned how to check the details about the name and installed Version of Linux Mint. You can get detailed information about your system by following this tutorial. From all the information, as mentioned above, I hope now you can find the installed Version of any Linux distribution. We have discussed two different ways, i.e., by using a command line and by using a graphical user interface, through which a user can display the information about the installed Linux distribution. If you feel any difficulty related to the ways as mentioned above, then let us know via your feedback through the comments. We will welcome your queries.

About the author

Aqsa Yasin

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.

Источник

How to Find Linux OS Name and Kernel Version You Are Running

There are several ways of knowing the version of Linux you are running on your machine as well as your distribution name and kernel version plus some extra information that you may probably want to have in mind or at your fingertips.

Therefore, in this simple yet important guide for new Linux users, I will show you how to find out your Linux system OS version from the command line. Doing this may seem to be a relatively easy task.

However, having a good knowledge of your system is always a recommended practice for a good number of reasons including installing and running the appropriate packages for your Linux version, for easy reporting of bugs coupled with many more.

Читайте также:  Linux env добавить переменную

With that said, let us proceed to how you can figure out information about your Linux distribution.

Find Linux Kernel Version Using uname Command

We will use the uname command, which is used to print your Linux system information such as kernel version and release name, network hostname, machine hardware name, processor architecture, hardware platform, and the operating system.

To find out which version of Linux kernel you are running, type:

In the preceding command, the option -o prints the operating system name, and -r prints the kernel release version.

You can also use -a option with uname command to print all system information as shown:

Check Linux Kernel Version

Find Linux OS Info Using /proc/version File

Next, we will use /proc file system, which stores information about processes and other system information, it’s mapped to /proc and mounted at boot time.

Simply type the command below to display some of your system information including the Linux kernel version:

Show Linux System Information

From the image above, you have the following information:

  • A version of the Linux (kernel) you are running: Linux version 5.15.0-53-generic
  • Name of the user who compiled your kernel: [email protected]
  • A version of the GCC compiler used for building the kernel: gcc version 20.04.1
  • Type of the kernel: #1 SMP (Symmetric MultiProcessing kernel) supports systems with multiple CPUs or multiple CPU cores.
  • Date and time when the kernel was built: Thu Oct 20 15:10:22 UTC 2022

Find the Linux Distribution Name and Release Version

The best way to determine a Linux distribution name and release version information is by using the cat /etc/os-release command, which works on almost all Linux systems.

/etc/os-release file

$ cat /etc/os-release [On Debian, Ubuntu and Mint] $ cat /etc/os-release [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ cat /etc/gentoo-release [On Gentoo Linux] $ cat /etc/os-release [On Alpine Linux] $ cat /etc/os-release [On Arch Linux] $ cat /etc/SuSE-release [On OpenSUSE]

Find Linux Distribution Name and Release

lsb_release Command

Alternatively, you can also use the lsb_release tool, which will print LSB (Linux Standard Base) information about the Linux distribution on your terminal. The lsb_release command is not installed by default, you need to install it using your default package manager as shown.

$ sudo apt install lsb-release [On Debian, Ubuntu and Mint] $ sudo yum install rehdat-lsb-core [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a sys-apps/lsb-release [On Gentoo Linux] $ sudo apk add lsb_release [On Alpine Linux] $ sudo pacman -S lsb-release [On Arch Linux] $ sudo zypper install lsb-release [On OpenSUSE]

Once installed, run the lsb_release utility to print the standard Linux system information as shown.

Find Linux OS Information

hostnamectl Command

The hostnamectl command is a systemd utility that is used to get the Linux operating system information and also used to change or set the system hostname.

Check Linux System Info

I’ve used the tmux terminal multiplexer for accessing multiple Linux terminal sessions simultaneously in a single terminal window.

In this article, we walked through a brief and simple guide intended to help new Linux users find out the Linux version they are running and also get to know their Linux distribution name and version from the shell prompt.

Perhaps it can also be useful to advanced users on one or two occasions. Lastly, to reach us for any assistance or suggestions you wish to offer, make use of the feedback form below.

Источник

Оцените статью
Adblock
detector