Accessorizing your Linux skills with the ability to check the OS version is like adding the finishing touches to a well-crafted outfit. Whether you’re using Ubuntu, Fedora, or any other Linux distribution, knowing the specifics of your operating system can be crucial for troubleshooting, system updates, or just satisfying that inner tech curiosity. To find out what version of Linux you’re running, you can simply use the command cat /etc/os-release. This command displays the distribution name and its version.

Navigating the Linux landscape can sometimes feel like being a detective in a complex maze of files and commands. Fear not, though! We’re here to simplify this journey. If you prefer a graphical user interface (GUI) over the command line, many desktop environments have built-in settings that show system information. For instance, in Ubuntu, you can find your OS details by searching in the settings menu. This method is user-friendly and avoids the terminal if you’re not quite at ease with the command line.
For those who live and breathe terminal commands, other powerful tools include uname, lsb_release, and hostnamectl. Each of these commands provides different layers of details about your Linux system, from the kernel version to the distribution information. It’s like peeling back the layers of an onion, revealing more about your system with each command. Understanding these commands not only empowers us as users but also makes us feel more in control of our computing environment. So, let’s dive into learning each method, ensuring we get the most out of our Linux experience.
Contents
Determining Your Linux Distribution
Identifying the specific Linux distribution and version running on our system is essential. Common methods include using terminal commands like lsb_release, inspecting the /etc/os-release file, and checking the Linux kernel version with uname.
Using Lsb_Release Command
The lsb_release command provides detailed information about the Linux Standard Base (LSB) and the distribution.
To use it, open the terminal and type:
lsb_release -a
This will reveal:
- Distributor ID: Name of the distribution (e.g., Debian, Ubuntu)
- Description: Full distribution name and version
- Release: Distribution release number
- Codename: Codename of the distribution release
This method is very reliable and works across many distributions like Debian, Ubuntu, CentOS, and Fedora.
Exploring /Etc/Os-Release File
The /etc/os-release file is another treasure trove of information. This file, written in plain text, contains data about the operating system. We can access it by typing:
cat /etc/os-release
Inside, we find variables such as:
- NAME: Pretty name of the OS
- VERSION: Version number with details
- ID: Identifier (ubuntu, debian, etc.)
- ID_LIKE: Related distributions
- VERSION_CODENAME: Codename
For example, on an Ubuntu machine, you might see:
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
VERSION_CODENAME=focal
Leveraging Uname for Kernel Information
The uname command focuses on the kernel details rather than the distribution, but it is still crucial for a complete understanding.
When we type:
uname -r
It returns only the kernel version, such as “5.4.0-42-generic”. For more detailed information, uname -a can be used. This would output the:
- Kernel name
- Network node hostname
- Kernel release
- Kernel version
- Machine hardware name
- Hardware platform and the operating system
This command is integral for understanding the compatibility and performance specifics of the Linux kernel in use.
Understanding Linux Versions and Releases
Knowing the different aspects of Linux versions and releases can help us maintain and troubleshoot our systems more effectively. We’ll cover kernel versioning, system architecture, and security updates.
Kernel Versioning Explained
The Linux kernel is at the core of any Linux-based operating system. It manages hardware, runs processes, and maintains security. Each version of the kernel is identified by a version number like “5.10.0-14-amd64.”
Kernel versions follow a specific structure:
- Major version: Significant changes (e.g., “5”).
- Minor version: New features and enhancements (e.g., “10”).
- Patch level: Bug fixes (e.g., “0”).
- Additional indicators: Distribution-specific modifications (e.g., “14-amd64”).
Updating the kernel can improve performance, enhance security, and provide support for new hardware.
Identifying System Architecture
Understanding your system’s architecture is crucial for choosing the correct software. Common architectures include x86 and x86_64. The former is used for 32-bit systems, while the latter suits 64-bit systems. Why does this matter? It ensures compatibility. Installing software designed for a different architecture can result in performance issues or complete incompatibility.
To check your architecture, you can use:
uname -mlscpu
This tells you the architecture and whether it’s 32-bit or 64-bit.
Security Patches and Updates
Keeping the system secure requires regular updates. Security patches address vulnerabilities identified in the operating system. Ignoring these can expose us to security risks.
Linux distributions like Ubuntu, Fedora, and Debian regularly release updates to mitigate security threats. Tools such as:
apt-get(Debian-based)yum(Red Hat-based)
are used to apply these updates. It’s recommended to schedule regular updates to ensure we’re protected against known vulnerabilities. These can range from minor fixes to significant updates requiring system reboots.
Command Line Mastery for Administration
Mastering the command line for administration tasks is crucial. We explore key Linux commands, advanced system information retrieval, and custom CLI tools and scripts.
Navigating the Linux filesystem efficiently is fundamental. Basic commands like ls, cd, and pwd help us move through directories quickly.
File Handling Commands:
cat: Concatenate and display the content of files.cp: Copy files or directories.mv: Move or rename files or directories.rm: Remove files or directories.
Using find and grep allows us to search files and directories effectively. Additionally, chmod and chown help set permissions and ownership, ensuring secure file access. These commands are essential for any Linux administrator.
Advanced System Information Retrieval
Retrieving detailed system information is key to effective system administration. Commands like uname -a provide kernel details, while hostnamectl shows the hostname and OS details.
System Information Commands:
lsb_release -a: Displays the distribution-specific information.df -h: Shows disk space usage.free -m: Displays memory usage.top: Real-time system monitoring.
Commands like systemctl manage systemd services, which are vital for modern Linux distributions. These tools allow us to diagnose issues, monitor performance, and maintain system health.
Custom CLI Tools and Scripts
Creating custom CLI tools and scripts enhances our productivity and effectiveness. Using bash scripting, we automate repetitive tasks, from backups to system updates.
Scripts can include common utilities like cron jobs for scheduling tasks or awk and sed for text processing.
| Tool | Function | Example |
| `cron` | Schedules repetitive tasks | `crontab -e` |
| `awk` | Text processing | `awk ‘{print $1}’ file.txt` |
| `sed` | Stream editing | `sed ‘s/original/replace/’ file.txt` |
We can also create custom aliases and shortcuts to streamline our workflow. These practices allow us to tailor the command-line interface to our specific needs, increasing our efficiency and control over the system.
Exploring Desktop and Server Environments
In the world of Linux, understanding the desktop and server environments is crucial. Desktop environments (DEs) provide the GUI we often interact with, while server setups are more about efficiency and less about visuals.
Desktop Environments (DEs)
DEs define the look and feel of our systems. Common options include:
- GNOME: Found in distros like Fedora and Ubuntu, GNOME offers a sleek interface.
- KDE Plasma: Highly customizable, often seen in Kubuntu and openSUSE.
- XFCE: Lightweight, suited for older hardware, used by Xubuntu and Manjaro XFCE.
We can quickly identify our DE by using the command:
echo $DESKTOP_SESSION
Server Environments
For Linux servers, GUIs are rare. Admins interact using terminal commands, maximizing resources:
Popular Server Distros:
Popular Server Distros
- CentOS Stream: Stability, ideal for enterprise use.
- Ubuntu Server: Frequent updates, wide community support.
- Alpine Linux: Minimalist, known for its security.
Our server’s OS version is checked with:
cat /etc/os-release
We might ask, why no GUI on servers? It boils down to performance and security.
Rolling Release Distros
Distributions like Arch Linux and openSUSE Tumbleweed offer rolling releases. They provide the latest software updates continuously, ideal if we want the bleeding edge.
In these environments, the balance between cutting-edge features and potential stability issues is key.
Examples of Commands
For a broader insight, more commands are used:
lsb_release -a
hostnamectl
uname -r
These help us gather info about the OS and kernel versions. It’s handy for both troubleshooting and optimizing our system.