Linux Introduction
Overview
What is Linux?
Linux is an operating system, just like Windows or macOS, that serves as the software foundation for computers and other devices. It's known for being open-source, which means its source code is freely available and can be modified by anyone. This has led to a global community of developers collaborating to make it better.
Why Linux?
It's light. It's stable. And it's free.
It's light
Linux requires a little amount of resources comparing to Windows to run the OS. Some Linux OS is so small that the whole OS size is 130MB (Alpine).
It's stable
Linux doesn't need a reboot when some configurations have been changed. It's only necessary when the kernel is updated. You can run a server for years without restarting it.
Linux has less malware than Windows. By design, Linux does not process executables without explicit permission. You have to allow execution permission explicitly on a file to run it. That's why when infected, the virus couldn't be executed.
It's free
Linux is an open-source application. You have a zero cost of entry. More than that, you can even modify Linux to suit your needs and redistribute it as a new distribution.
Who invented Linux?

Linus Torvalds
In early 1991, unhappy with MS-DOS and MINIX, Torvalds wanted to buy a UNIX system. Luckily for us, he didn't have enough money. So he decided to make his own clone of UNIX, from scratch.
Oh he also created Git. :)
How is Linux Developed?
Linux is made up of two main parts: the kernel and user space. The kernel is like the core brain of the system, managing hardware and resources, while user space includes everything else – the programs, tools, and interfaces you interact with.
Contributors and Collaboration
The development of Linux is a collaborative effort involving thousands of programmers from around the world. They contribute by writing new code, improving existing code, fixing bugs, and suggesting new ideas. They work together online, using tools like version control systems, email lists, and forums.
Linux Kernel Development
The kernel is the heart of Linux, responsible for managing hardware, memory, and tasks. Linus Torvalds, who started Linux, is still its main overseer. He reviews and approves changes submitted by other developers. These changes are called "patches," and they can range from small fixes to major new features.
Distribution and Distro Maintainers
To create a complete Linux system, people combine the kernel with user space software. These combinations are called "distributions" or "distros." Examples include Ubuntu, Fedora, and Debian. Distro maintainers customize these combinations and make sure everything works together seamlessly.
Versioning
Linux development happens in versions. A new version of the kernel is released every few months, and each version brings improvements, new features, and bug fixes. Some versions are designated as LTS (Long-Term Support), meaning they're maintained with security updates for an extended period.
Testing and Quality Assurance
Before new code is added to the main kernel, it goes through rigorous testing to make sure it's stable and won't cause problems. Various testing techniques are used, and there's a strong emphasis on maintaining the overall quality of the codebase.
Coding Style and Documentation
Linux developers follow specific coding styles and conventions to make the code readable and consistent. They also write documentation to help others understand how the code works, which is crucial for collaboration and maintenance.
Community and Learning:
Getting involved in Linux development is a great learning experience. You can start by fixing simple bugs, writing documentation, or learning from existing code. It's an opportunity to work with experienced developers, learn about real-world software development, and make a meaningful impact on a globally used system.
In summary, Linux development is a collaborative effort involving a global community of programmers who work together to build and improve an open-source operating system. It's a dynamic, exciting, and educational field that offers numerous opportunities for growth and contribution.
Distros
"Distro" is short for "distribution" in the context of Linux. A Linux distribution (or distro) is a complete operating system that consists of the Linux kernel, a package manager, a collection of software applications, and a graphical user interface (GUI), all bundled together and tailored to serve specific needs. Think of it as a "packaged" version of Linux that you can install on your computer or device.
Here's a breakdown of what a Linux distribution entails:
-
Linux Kernel: The kernel is the core part of the operating system that interacts with hardware, manages resources like memory and processors, and provides the foundation for running software.
-
Package Manager: A package manager is a tool that helps you install, update, and manage software packages on your system. It simplifies the process of adding and maintaining software components.
-
Software Repositories: Distributions usually provide a set of software repositories (online repositories) where you can find pre-packaged software applications. These repositories ensure that you can easily download and install software without hunting all over the internet.
-
User Space: The user space includes various software applications and tools, such as text editors, web browsers, media players, development tools, and more. These applications make up the user's interaction with the system.
-
Desktop Environment or Window Manager: A distro often comes with a graphical user interface that provides a way for users to interact with the system. Popular desktop environments include GNOME, KDE Plasma, Xfce, and more. Window managers offer a lightweight interface for users who prefer more control over the look and feel of their desktop.
-
Configuration Tools: Many distros include tools to configure system settings, manage hardware, set up network connections, and customize the user experience. These tools simplify administrative tasks for users.
-
Default Applications: Each distro might come with its set of default applications for tasks like web browsing, email, office productivity, multimedia, and more. The selection of default apps can vary between distros.
-
Philosophy and Target Audience: Different distros have varying goals and philosophies. Some are focused on user-friendliness, while others prioritize minimalism, security, education, or specialized use cases like scientific computing or ethical hacking.
Examples of well-known Linux distributions include:
-
Ubuntu:
- User-Friendly: Ubuntu is known for its user-friendly interface and ease of use, making it a popular choice for beginners transitioning to Linux.
- Regular Releases: Ubuntu follows a predictable release cycle, with regular updates every six months and Long-Term Support (LTS) versions every two years.
- Software Management: Ubuntu uses the Debian package format and the APT package manager. The Software Center provides a graphical interface for software installation.
- Desktop Environments: The default desktop environment is GNOME, but there are official flavors with other desktop environments like KDE, Xfce, and more.
- Community: Ubuntu has a large and active community that offers support and resources to users.
-
Fedora:
- Cutting-Edge: Fedora focuses on integrating the latest software and technologies, making it suitable for users who want to stay on the forefront of innovation.
- Frequent Releases: Fedora releases new versions every six months, offering the latest software updates and features.
- Systemd and RPM: Fedora uses the RPM package format and the DNF package manager. Systemd is the init system, enhancing system management and boot speed.
- Workstation and Server Editions: Fedora offers separate editions optimized for desktop users and server environments.
- Community: Fedora has an active community that contributes to both the development and testing of the distribution.
-
Debian:
- Stability and Freedom: Debian is known for its emphasis on stability and commitment to free and open-source software principles.
- Long Release Cycles: Debian's stable releases have longer development cycles, focusing on providing a reliable and secure environment.
- APT and dpkg: Debian uses the APT package manager and the dpkg package format. The package management system is renowned for its reliability.
- Multiple Architectures: Debian supports a wide range of hardware architectures, making it versatile for various systems.
- Community-Driven: Debian is developed by a large and dedicated community of volunteers, emphasizing open collaboration.
-
CentOS:
- Stability and Enterprise Focus: CentOS aims to provide a stable and secure platform for enterprise environments and server deployments.
- Derived from RHEL: CentOS is a community-supported clone of Red Hat Enterprise Linux (RHEL), leveraging RHEL's stability and features.
- Long-Term Support: CentOS provides long-term support and security updates, aligning with RHEL's lifecycle.
- YUM Package Manager: CentOS uses the YUM package manager and RPM package format.
- Systemd: Like Fedora, CentOS also uses the systemd init system.
- API Note: CentOS has been deprecated after IBM acquired Red Hat. However, several new distros that aims to succeed CentOS. The most notable one is Rocky Linux.
-
Arch Linux:
- Customization and Control: Arch Linux is designed for users who prefer maximum control and customization. It follows a "do-it-yourself" approach.
- Rolling Release: Arch is a rolling-release distribution, meaning software updates are continuously integrated rather than following fixed release cycles.
- Pacman Package Manager: Arch uses the Pacman package manager, known for its efficiency and simplicity.
- Documentation and Community: Arch has an extensive and well-regarded wiki that provides documentation and guides for various configurations.
- Minimalism: Arch starts as a minimal installation, allowing users to build their system with only the components they need
Below are some more well-known distros that target specific niche:
- Kali Linux: Kali Linux focuses on hacking and security auditing. It provides tools for penetration testing and security research.
- Alpine Linux: Alpine is known for its small size. It is used for a machine that has resource constraints.
- Raspbian (Raspberry Pi OS): RPI OS is the Linux that was designed to run on Raspberry Pi.
You can study the family tree of Linux distributions by visiting this link.
Package Manager
Package managers are essential tools in Linux distributions for installing, updating, and managing software packages. Here's a breakdown of the differences between some popular package managers:
-
APT (Advanced Package Tool) - Used in Debian and Ubuntu:
- Package Format: APT uses the
.debpackage format. It includes software dependencies, configuration files, and metadata. - Commands: Common APT commands include
apt-get,apt, anddpkg. - Features: APT can handle dependencies and resolve conflicts during installation and updates. It's known for its reliability and ease of use.
- Repositories: APT repositories contain software packages organized by distribution version. Ubuntu's Software Center is a user-friendly frontend for APT.
- Package Format: APT uses the
-
DNF (Dandified YUM) - Used in Fedora and CentOS:
- Package Format: DNF uses the
.rpmpackage format. RPMs contain software files, metadata, and scripts for installation and removal. - Commands: DNF's main commands are
dnfandrpm. - Features: DNF introduces better dependency resolution and transactional capabilities compared to the older YUM package manager.
- Repositories: DNF repositories contain RPM packages grouped by category, and you can define multiple repositories to access software.
- Package Format: DNF uses the
-
Pacman - Used in Arch Linux:
- Package Format: Pacman uses its own
.pkg.tar.xzpackage format. It includes the software and metadata required for installation. - Commands: Pacman's commands include
pacman,makepkg, andpactree. - Features: Pacman is known for its speed and simplicity. It resolves dependencies and supports package versioning.
- Repositories: Arch Linux's official repositories are complemented by the Arch User Repository (AUR), a community-driven collection of user-contributed packages.
- Package Format: Pacman uses its own
-
zypper - Used in openSUSE:
- Package Format: Zypper works with RPM packages, similar to DNF. It's used in openSUSE and SUSE Linux Enterprise.
- Commands: Zypper's commands include
zypperandrpm. - Features: Zypper provides dependency resolution, rollback capabilities, and integration with openSUSE's system management tools.
- Repositories: Zypper interacts with repositories containing RPM packages and supports both official and community repositories.
-
portage - Used in Gentoo:
- Package Format: Portage packages are called "ebuilds." They consist of scripts that define how software is built and installed.
- Commands: Portage's main command is
emerge. - Features: Portage is source-based, meaning it compiles software from source code, allowing maximum customization. It also supports binary packages.
- Repositories: Gentoo's repository contains ebuilds, which are organized into categories.
Each package manager has its strengths and aligns with the philosophy of its respective distribution. When choosing a distribution, understanding its package manager can help you assess its suitability for your needs, including ease of software management, customization options, and available software repositories.
Linux Anatomy
The "anatomy" of Linux refers to its fundamental components and how they interact to create a functioning operating system. Here's an overview of the key components that make up the anatomy of Linux:
-
Kernel: The core of Linux is the kernel, which acts as an intermediary between hardware and software. It manages system resources, controls hardware devices, and provides essential services like memory management, process scheduling, and hardware abstraction.
-
Shell: The shell is the command-line interface that allows users to interact with the operating system. It interprets user commands and executes them, providing a way to manage files, run programs, and configure system settings. Common shells include Bash (Bourne Again Shell) and Zsh (Z Shell).
-
Filesystem: Linux uses a hierarchical file system similar to a directory tree. Files and directories are organized under the root directory ("/"). Common directories include "/bin" (system binaries), "/home" (user home directories), "/etc" (system configuration files), and more.
-
Processes: Processes are running instances of programs. The kernel manages processes, allocating resources and scheduling their execution. Processes can run in the background or the foreground and interact with system resources.
-
Users and Permissions: Linux is a multi-user system, and each user has a unique identity. Permissions control who can access files and execute programs. Permissions are categorized as read, write, and execute, and they are set for the owner, group, and others.
-
Packages and Package Managers: Software packages are collections of files that make up applications. Package managers like APT, DNF, and Pacman help users install, update, and manage software by resolving dependencies and ensuring proper installation.
-
Networking: Linux supports networking, enabling communication between computers over local or global networks. Networking features include TCP/IP protocol support, network configuration tools, and networking daemons.
-
Daemons and Services: Daemons are background processes that run independently of user interaction. They provide various services such as network services, printing, and system monitoring. Init systems like Systemd manage daemons and services.
-
Graphical User Interface (GUI): While Linux can be operated entirely from the command line, most distributions provide a GUI for user convenience. Desktop environments like GNOME, KDE, and Xfce offer graphical interfaces, icons, and windows for interaction.
-
Device Drivers: Device drivers enable the kernel to communicate with hardware devices. They provide an interface for the kernel to control hardware components like graphics cards, printers, and network adapters.
-
Libraries: Libraries are collections of precompiled code that provide functions and routines for various programming tasks. They help developers avoid reinventing the wheel by providing reusable code.
-
Init System: The init system is the first process started by the kernel and manages subsequent processes as the system boots up. Different distributions use different init systems; for example, Systemd, Upstart, or SysV. API Note: SystemD is the current de-facto standard
This is a high-level overview of the anatomy of Linux. Each of these components plays a critical role in creating a fully functioning and versatile operating system. Understanding these components can provide insights into how Linux works and how to effectively use and manage it.
Linux Directory Structures
The base of Linux file system begins at the root("/") and everything starts with the root directory.
Common Top-Level Directories
/bin: binary or executable program/etc: system configuration files/home: home directory. It is the default current directory/opt: optional or third-party software/tmp: temporary space, typically cleared on reboot/usr: user related programs/var: log files
Some Other Directories
/boot- It contains all the boot-related information files and folders such as conf, grub, etc./dev– It is the location of the device files such as dev/sda1, dev/sda2, etc./lib– It contains kernel modules and a shared library./lost+found– It is used to find recovered bits of corrupted files./media– It contains subdirectories where removal media devices inserted./mnt– It contains temporary mount directories for mounting the file system./proc– It is a virtual and pseudo-file system to contains info about the running processes with a specific process ID or PID./run– It stores volatile runtime data./sbin– binary executable programs for an administrator./srv– It contains server-specific and server-related files./sys– It is a virtual filesystem for modern Linux distributions to store and allows modification of the devices connected to the system.