Kiến Thức Linux

What is Linux?

What is Linux?

Introduction

Linux is the most popular operating system today, next to Windows and MacOS. This open-source system is free and has a long-standing history of reliability, security, and flexibility.

As Linux is present in many devices and brings numerous advantages, it’s essential to learn what it is and how it impacts the computer industry.

This article takes a deep dive into Linux and why it’s one of the most used technologies today.

What is Linux?

Linux Definition

Linux is a kernel that has an ecosystem of open-source operating systems. The system is based on the UNIX operating system and has numerous distributions built around the same kernel.

Note: Linux often refers both to the kernel and operating system. The Linux kernel is the core of every Linux distribution.

Linux is known for being reliable, stable, secure, and flexible. Its features make it a popular choice for running supercomputers, servers, and desktop machines. It is also often used as an embedded application (software) in embedded systems. Linux is the core of many everyday devices, such as phones, smart TVs, and wearables.

Unix vs. Linux

Unix and Linux are two distinct technological solutions:

  • Linux is a Unix-like operating system, specifically a kernel inspired by a version of a Unix kernel.
  • Unix is an operating system with many different kernel versions.

Although the two technologies share some similarities, each solution has unique features. The table below provides a brief overview of the differences.

Unix Linux
Developed in the 1960s and 1970s by Bell Labs researchers. Made by Linus Torvalds in 1991.
The original license is proprietary. The source code has restricted distribution and modification options. The source code is freely available for distribution and modification (open source).
Multiple kernel versions. Single kernel, numerous distributions.
Several commercial versions with distinct features and capabilities. Numerous commercial and community-created distributions.
Development is closed and maintained by vendors. Development is open and community-driven.

Linux is a clone of Unix, but it is not Unix. The kernel borrows many ideas from Unix, such as the interface for programming APIs using the POSIX standard. Still, the code is not a direct derivative of the Unix source code.

Linux OS History: An Overview

Linus Torvalds developed Linux in 1991 as a student at the University of Helsinki. The original Linux kernel was made for computers that use Intel microprocessors 80386.

During that time, Linus used Minix, a cheap Unix made as a learning platform. Due to the licensing restrictions which limited changes in the source code, Linus decided to create an operating system kernel. The project started as a simple terminal emulator used to connect to larger Unix systems at the university, which was further developed and improved.

In 1991 the first Linux version appeared on the Internet. The project becomes collaborative, and many programmers participate in its development. The system works on many different processor versions as a result. New companies appear that specialize in Linux, such as Red Hat, while giants such as Intel provide Linux solutions for embedded systems, desktop machines, and servers.

One of the most exciting characteristics of Linux is that it is not a commercial product. The creator maintains the kernel while a connected group of developers continues development. The project is a result of collaboration through the Internet.

Linux Architecture

The Linux kernel has a monolithic and open architecture. The basic Linux operating system architecture consists of three layers:

  • Hardware. The physical components of a machine: memory (RAM) and the processor (CPU).
  • Kernel. The in-memory software and a controller for the CPU. The kernel serves as a connector between hardware and processes.
  • Processes. Kernel-controlled running programs on the system. Processes make up all tasks outside the kernel.
OS layers communication

The Linux system separates the virtual memory into two distinct spaces:

  • Kernel space is a virtual memory segment reserved for running the system kernel, kernel modules, and most device drivers.
  • User space (or userland) is a virtual memory segment reserved for running all code outside the kernel.

The kernel plays a central role in the Linux operating system and works with many different architecture segments. Below is a brief overview of the main components of Linux.

Bootloader

A bootloader is a program that runs every time a Linux system powers up or restarts. The primary function of the bootloader is to load the kernel into memory and start the boot process.

Apart from locating and loading the kernel, the program also sets up the initial startup environment for the kernel and provides required information.

The two most common bootloaders for Linux are:

  • GRUB. The GRand Unified Bootloader (GRUB) is the most common default bootloader on various Linux distributions. The program allows choosing the operating system in a multi-OS environment, configuring boot options, running GRUB rescue modes, and picking alternate kernels.
  • LILO. The LInuxs LOader (LILO) is a less common, but still used, bootloader on some Linux systems. The program has a simple design and fever configuration options compared to GRUB.
grub menu

After completing the boot process, the Linux kernel continues running the operating system.

Kernel

A kernel is the lowest level of software in an operating system. It serves as a communication point between hardware and applications. The Linux kernel is monolithic, written in C and Assembly. It provides all the low-level processes necessary to run the system.

A Linux kernel manages the following components:

  • Device drivers. The kernel acts as a mediator between hardware and processes.
  • Memory. The kernel keeps track of memory usage, including what is stored and where.
  • Process management. Schedules CPU requests from processes and distributes the processor time accordingly.
  • System calls and security. The kernel handles all system calls and processes the requests in the kernel space.

By managing low-level tasks, the kernel provides an abstraction layer between the user and hardware while allowing a user to access hardware information. The use of libraries turns certain functionalities on and off in the kernel, making it very customizable and flexible.

The additional flexibility to access information while abstracting away the hardware provides a very modular kernel model.

Init System

The init system is a Linux daemon process started by the kernel. The purpose of the init system is to initialize the user space during boot and manage system processes during runtime. The init system tasks include:

The original Linux init system was based on the Unix SystemV (SysV) init system. SysV relied on scripts in the /etc/init.d directory to start, stop, and restart services sequentially, depending on runlevels.

/etc/init.d contents

Most major Linux distributions (Ubuntu, CentOS, Fedora, Debian) implement the init system with systemd, which is backward-compatible with SysV. The system offers faster boot time and better system management capabilities, such as detailed logging through journalctl.

Some Linux systems allow choosing between different init systems during installation. The choice is critical and affects the overall system behavior.

Daemons

Daemons are background processes that initiate during boot. and wait for specific events or requests to occur without user intervention. Some examples of daemon processes include:

  • systemd. The central daemon responsible for managing other daemon processes.
  • sshd. The SSH server daemon that listens for incoming SSH connection requests, enables secure connection to a remote server, and allows file transfers.
  • httpd. A web server daemon that listens for HTTP requests and serves web pages.
  • cron. A daemon that executes scheduled tasks or scripts from the cron table (crontab) at requested times.

Linux contains numerous daemon processes, each with specific functionality. Overall, daemons ensure programs run smoothly on the system.

Graphical Server

The graphical server is a basic framework on Linux that displays graphics on a monitor. The component implements the X Window System (X11 or X) and enables window management, keyboard/mouse input, and multiple display support.

The X Window System does not provide a user interface. Different programs handle the details of the visual interface that users interact with.

Desktop Environment

A desktop environment provides software that implements the graphical user interface (GUI). The desktop environment provides a logical and user-friendly way to navigate the various operating system components.

almalinux desktop environment 1

Linux offers several different desktop environments to choose from, and they are distribution independent.

Desktop environments contain several built-in applications, such as a text editor, configuration programs, web browsers, and other utilities.

Applications

Applications are the highest layer of the Linux operating system. Most Linux distributions offer a centralized app store environment to search for and install applications.

Note: For Windows users migrating to Linux, programs such as Wine allow running Windows applications on Linux. If you are using Ubuntu and wish to use Windows applications, read our guide on how to install Wine on Ubuntu.

How Linux Works

Linux manages hardware resources and provides an interface to interact with system resources. The kernel is the central component of the operating system that interacts with the hardware.

The critical components built around the kernel that enable the workings of Linux are in the following sections.

Linux Shell

Linux uses a command-line interface called a shell to communicate with the kernel. The shell enables users to interact with the operating system using various Linux commands instead of a GUI. Several popular shell types exist, such as Bash, Zsh, Fish, and others.

Friendly interactive shell fish example commands

Using text-based commands provides access to various Linux utilities and tools. The shell enables file management, administrative tasks, and configuring system settings.

Linux File System

The Linux file system determines the storage method for files and directories on a solid-state drive (SSD) or hard disk drive (HDD). Linux supports various file system types, the most common being the Extended File System (ext).

Commonly found file systems on Linux include:

  • ext2 is on many early Linux systems and does not include journaling.
  • ext3 is an extension of ext2 with added journaling to keep track of file system changes.
  • ext4 is the default for most modern Linux distributions. The file system supports large file systems, better performance, and scalability.
  • Btrfs (B-tree file system) offers advanced features, like RAID support and self-healing.
  • XFS is a robust and high-performance file system for large-scale file systems and files.

The choice of the file system depends on the specific needs, requirements, and use case.

Linux Processes

A process in Linux is a single work unit in the operating system. Any instance of a running command or program is a process with a unique identifier (process ID or PID).

Processes have several different states, such as:

  • Running. The state of a process currently executing in the CPU.
  • Sleeping. A state where a process is waiting for resources or a specific event.
  • Zombie. A zombie process is stopped and not thoroughly cleaned up.
  • Stopped. A state where a process is not running and is ready to be resumed or terminated.
  • Orphaned. A process whose parent process ended.

Linux provides various utilities and tools to manage processes:

top command terminal program output

Working with processes is essential for Linux. Knowing how to manage processes helps troubleshoot software issues, optimizes performance, and directly manages system resources.

Linux User Permissions

Linux uses the file system’s permission model. The model assigns different permissions based on three distinct levels:

  • User (u) is the user who owns a file or directory.
  • Group (g) is multiple users who have similar permissions.
  • Others (o) are all other users who are neither owners nor members of groups.

User permissions allow different tasks for files and directories. The available user permissions are:

  • Read (r) lets the specified user view files or file names within a directory.
  • Write (w) enables a user to modify or remove file contents. A user with write permissions can create, move, and delete directories.
  • Execute (e) gives a user permission to execute script/program files, access, and traverse directories.

To view the permissions for a file or directory, run the ls command with the -l option. The output shows the permissions for the user, group, and others. For example:

-rw-r--r-- 1 user group 2028 Aug 19 2:00 file.txt
linux permissions

The first character sequence represents the permissions. The example shows the user has read and write permissions, while the group and others have read permissions.

To change file or directory permissions, use the chmod command.

Package Management in Linux

Packages are a standardized way to distribute software on Linux distributions. A package is a compressed archive with all data required to install some software.

Linux-based operating systems use package management systems to install, remove, and update software packages. The package managers resolve dependencies and update package repositories to maintain consistency.

Linux distributions provide a readily-available package management system for software installation and maintenance. Popular package managers include the following:

  • APT (Advanced Package Tool). The APT package manager is a Debian package manager used in Debian-based distributions, such as Ubuntu. The package format uses .deb files found and maintained in package repositories. Commands such as apt or apt-get help install, update, remove packages, and automatically resolve dependencies.
  • RPM (Red Hat Package Manager). The RPM package manager appears in Red Hat-based distributions like Fedora and CentOS. Commands such as rpm and yum help manage packages in the .rpm format. RPM resolves most package dependencies but requires manual intervention in specific cases.
  • Pacman. The Pacman package manager appears on Arch Linux and similar distributions. The lightweight package manager works with .pkg.tar.xz file format and automatically handles all dependencies. The pacman command allows managing packages from the terminal.

Linux distributions also offer higher-level solutions to manage packages through the GUI as a user-friendly approach.

Networking With Linux

Linux contains a robust stack for network management, monitoring, and troubleshooting tools. The networking options in Linux are highly customizable and support many networking protocols.

bmon interface

Some crucial Linux networking elements include:

  • IP addresses. An IP address is a distinctive identifier for a device in a Linux network consisting of four octets (for example, 192.168.1.1). The identifier is critical in routing network traffic in a network. Addresses are either assigned manually or automatically using a protocol such as DHCP.
  • Interfaces. Linux supports various networking interfaces, such as Wi-Fi, Ethernet, and virtual interfaces. Every network interface has a unique name, such as eth0, lo (loopback), or wlan0. Commands such as the ip or ifconfig provide an overview and configure network interfaces.
  • Configuration files. Linux uses configuration files to define various network settings. For example, Debian-based systems use the /etc/network/interfaces for networking tasks, while Red Hat-based systems store configuration files in /etc/sysconfig/network-scripts/.
  • DNS. The Domain Name System (DNS) translates human-readable addresses into IP addresses. Linux defines resolves in the /etc/resolv.conf file manually or dynamically.
  • Routing. Linux supports routing and stores routing tables to define gateways and network traffic. Commands, such as ip route, help maintain and manage the routing table.
  • Services. Various network services provide network functionalities to devices and users. Examples include web, mail, DNS, FTP, and SSH servers.
  • Tools. Linux has many networking tools for troubleshooting and managing networking tasks, such as ping and traceroute.

The available programs, tools, and customization make Linux popular among network administrators.

Drivers

Drivers enable an operating system to interact with connected hardware. Devices such as USBs, graphic cards, sound cards, and network adapters require drivers to function correctly.

Drivers typically work as kernel modules on Linux.

Note: See how the modprobe command adds and removes kernel modules

Advantages and Disadvantages of Linux

Numerous advantages and disadvantages are significant to consider when looking at Linux. Most advantages and disadvantages depend on personal preferences and requirements.

Below is an overview of the top pros and cons of Linux.

Linux Advantages

As one of the most popular operating systems today, Linux has many advantages. Some important positive features of Linux are:

  • Open source. As an open-source system, Linux is free to use, modify, and distribute. Development is transparent and collaborative. Open systems encourage learning about technology and innovation.
  • Stability. Linux is known as a stable and reliable system. It is suitable for critical systems, servers, and real-time applications. Linux runs for long periods without requiring a reboot.
  • Security. Limited malware exposure, robust system permissions, and quickly addressed vulnerabilities through patches.
  • Customization. The operating system experience is fully configurable. Choose between various desktop environments, software packages, and window managers.
  • Software availability. Although there are fewer commercial software options, open-source software solutions and alternatives continually increase.

Linux Disadvantages

Linux has several disadvantages, especially for users unfamiliar with the environment. Some drawbacks of Linux include the following:

  • Learning curve. Linux is known for having a steeper learning curve, especially for users migrating from Windows. Learning new commands, how the file system works, and overall configuration is a challenge for new users.
  • Compatibility. Software compatibility is a crucial factor to consider before migrating to Linux. Although many open-source alternatives exist, some proprietary software is unavailable for Linux.
  • Gaming. Although gaming on Linux is growing and becoming more popular, the system still needs to catch up to Windows for gaming support and compatibility.
  • Technical support. Linux focuses on having a reliable online community presence and extensive documentation. Dedicated technical support for troubleshooting and assisting with specific issues is hard to find.

Linux and Open Source

The Linux kernel is free software, meaning it is open-source code with a GNU General Public License. Users can download and make changes to the original source code. The only obligation is the distribution of changes requires having the same open-source license and available source code.

The open-source aspect of Linux plays a critical role in the widespread success and implementation of the system. Open-source principles affect Linux in many ways, creating a collaborative and creative community with free software.

Linux OS Uses

Due to its versatility, Linux OS appears in many contexts. Some common uses for the Linux operating system include:

  • Servers. Linux is a widely used operating system for web servers, database servers, file servers, and others. The stability, security, and scalability make Linux a great choice to power different server types.
  • Cloud computing and virtualization. Cloud services often rely on Linux-based operating systems to provide a reliable and scalable infrastructure. Virtualization platforms also frequently use Linux as the host operating system in virtualization platforms, such as Docker.
  • Desktop computers. Linux provides several different desktop environments and distributions for desktop computers and laptops, which offer all necessary desktop utilities and applications.
  • Mobile devices. The Linux kernel is the core of Android, one of the most prevalent mobile operating systems. The operating system suits smartphones, tablets, smart TVs, and other devices.
  • Embedded systems. Routers, smart appliances, IoT devices, and automotive systems predominantly use Linux.
  • Scientific research. Fields such as bioinformatics, computing simulations, data analysis, and high-performance computing (HPC) use Linux due to stability, performance, and software availability.
  • Development. Linux offers a wide array of development tools. Developers often prefer Linux due to its powerful command-line capabilities, scripting, and the availability of development libraries.
  • Education. Linux is a cost-effective way to teach computer science and other IT-related subjects. The OS is customizable to fit specific requirements, and several distributions are specifically designed for educational purposes.

Linux Distributions

Linux distributions (distros) are different variations of the Linux operating system. Every distribution combines the Linux kernel with software, tools, libraries, and desktop environments to serve a specific use case.

Below is a list of the most popular Linux distributions:

  • Ubuntu. Ubuntu is the most used and well-known Linux distribution. The distro focuses on being user-friendly, has a simple installation process, and has a great desktop experience.
  • Debian. Debian is a stable distribution and the basis for many Linux distributions (such as Ubuntu). The distribution supports multiple architectures and various software packages.
  • Mint. Mint is a user-friendly Linux distribution based on Ubuntu. The distribution has several desktop environments and is suitable for new Linux users.
  • Red Hat Enterprise Linux (RHEL). RHEL is a commercial open-source distribution known for solid support and stability for enterprise systems. The distribution is used in mission-critical systems due to long-term support and vast connections to software and hardware vendors.
  • Fedora. Fedora is a community-based distribution sponsored by Red Hat. The distribution aims to provide the latest software solutions and innovations while adhering to open-source principles.
  • CentOS. CentOS was a widespread distribution based on the RHEL source code. Server deployments often relied on CentOS due to being enterprise-friendly. The latest version of CentOS reached EOL, but there are many CentOS alternatives to consider.
  • Arch. Arch Linux is a minimal and highly customizable distribution with a DIY approach. The base installation is light and allows users to build a custom-tailored Linux experience.
  • Kali. Kali Linux is a specialized distribution for penetration testing and network security auditing. The distro comes with various security tools and is popular among ethical hackers and security specialists.

How to Choose a Linux Distribution?

Choosing the correct Linux distribution depends on many factors. The best approach is to try different distributions, preferably using a virtualization program such as VirtualBox or VMware.

Some critical matters to consider when choosing a Linux distribution are:

  • Purpose. Determine the purpose of using Linux on a machine to pinpoint the requirements. Different distributions are better suited as server operating systems, while others are oriented toward a desktop experience. Many specialized Linux distributions handle specific tasks by design.
  • Usability. A key factor to consider is previous experience with Linux. Some distributions, such as Ubuntu, Fedora, or Mint, are better suited for new users. Users who are comfortable with Linux and prefer to customize their experience can opt-in for Gentoo or Arch.
  • Hardware requirements. Check whether a distribution has support for your hardware setup. Some distributions require additional configuration and drivers, while others provide immediate support. Double-check for any compatibility issues through official forums and documentation.
  • Community support. Whether you’re a fresh Linux user or an experienced user trying a new distribution, community support is essential. Large communities offer more resources, guides, and assistance. An active community is a good indicator of a healthy distribution with frequent updates.
  • Preference. Ultimately, personal preference is crucial when sticking to a Linux distribution. There are various package management systems, desktop environments, philosophies, and the overall experience for every distribution is unique.

Conclusion

The article explained what Linux is, its infrastructure, and how it works. This versatile and powerful system is an integral part of the computing world and continues to foster a creative, innovative, and collaborative community through open-source principles.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !