Linux 101 #01

Meet Linux: What It Is, Where It Came From, and How It’s Built

Something about Linux

Linux, as you might already know, is an operating system used for personal computers, servers, and even mobile devices. However, Linux stands as a fundamental pillar in cybersecurity, renowned for its robustness, flexibility, and open-source nature. 

Linux is an operating system, just like Windows, macOS, iOS, or Android. An operating system (OS) is software that manages all the hardware resources of a computer, facilitating communication between software applications and hardware components. Unlike some other operating systems, Linux comes in many different distributions—often called “distros”—which are versions of Linux tailored to various needs and preferences. Linux is available in over 600 distributions (or an operating system based on the Linux kernel and supporting software and libraries). Some of the most popular and well-known being Ubuntu, Debian, Fedora, OpenSUSE, elementary, Manjaro, Gentoo Linux, RedHat, and Linux Mint.

Linux distributions – or distros – are operating systems based on the Linux kernel. Each Linux distribution is different, with its own set of features, packages, and tools. Many users choose Linux for their desktop computers because it is free, open source, and highly customizable. Ubuntu and Fedora are two popular choices for desktop Linux and beginners. It is also widely used as a server operating system because it is secure, stable, and reliable and comes with frequent and regular updates. Finally, we, as cybersecurity specialists, often prefer Linux because it is open source, meaning its source code is available for scrutiny and customization. Because of such customization, we can optimize and customize our Linux distribution the way we want and configure it for specific use cases only if necessary.

The main differences between the various Linux distributions are the included packages, the user interface, and the tools available. Kali Linux is the most popular distribution for cyber security specialists, including a wide range of security-focused tools and packages.

And last but not least, Linux is generally considered more secure than other operating systems, and while it has had many kernel vulnerabilities in the past, it is becoming less and less frequent. It is less susceptible to malware than Windows operating systems and is very frequently updated. Linux is also very stable and generally affords very high performance to the end-user. However, it can be more difficult for beginners and does not have as many hardware drivers as Windows.

How it's build

Components:

  • Bootloader: A piece of code that runs to guide the booting process to start the operating system. Parrot Linux uses the GRUB Bootloader.
  • OS Kernel: The kernel is the main component of an operating system. It manages the resources for system’s I/O devices at the hardware level.
  • Daemons: Background services are called “daemons” in Linux. Their purpose is to ensure that key functions such as scheduling, printing, and multimedia are working correctly. These small programs load after we booted or log into the computer.
  • OS Shell: The operating system shell or the command language interpreter (also known as the command line) is the interface between the OS and the user. This interface allows the user to tell the OS what to do. The most commonly used shells are Bash, Tcsh/Csh, Ksh, Zsh, and Fish.
  • Graphics server: This provides a graphical sub-system (server) called “X” or “X-server” that allows graphical programs to run locally or remotely on the X-windowing system.
  • Window Manager: Also known as a graphical user interface (GUI). There are many options, including GNOME, KDE, MATE, Unity, and Cinnamon. A desktop environment usually has several applications, including file and web browsers. 
  • Utilities: Applications or utilities are programs that perform particular functions for the user or another program

The Linux operating system can be broken down into layers:

  • Hardware: Peripheral devices such as the system’s RAM, hard drive, CPU, and others.
  • Kernel: The core of the Linux operating system whose function is to virtualize and control common computer hardware resources like CPU, allocated memory, accessed data, and others. The kernel gives each process its own virtual resources and prevents/mitigates conflicts between different processes.
  • Shell: A command-line interface (CLI), also known as a shell that a user can enter commands into to execute the kernel’s functions.
  • System Utility: Makes available to the user all of the operating system’s functionality.

Linux follows five core principles:

  • Everything is treated as a file: All configuration files for the various services running on the Linux operating system are stored in one or more text files.
  • Small, single-purpose programs: Instead of large, multi-functional applications, Linux relies on small utilities that each do one thing well, such as ls for listing files or cat for concatenating files.
  • Chaining programs together: The output of one program can be easily used as the input for another through the use of pipes (|), allowing users to combine simple tools to perform complex tasks.
  • Text as a Universal Interface: Linux tools use plain text for configuration and communication whenever possible. Text is simple, portable, and human-readable. Configuration files like /etc/passwd or /etc/hosts are just text.
  • Avoid captive user interfaces: Linux is designed to work mainly with the shell (or terminal), which gives the user greater control over the operating system.

File System Hierarchy

Linux uses a single-rooted tree structure, starting at / (root), with each directory having a specific purpose.

You can read more hear: File System Hierarchy

  • / – Root Directory: The top of the file system tree. Contains all other directories and files. For instance: /etc, /bin,/home all reside under /
  • /bin – Essential User Binaries:  Stores essential command-line binaries needed for all users. Examples: ls, cat, mv,…
  • /sbin – System Binaries: Contains administrative binaries for system management. Usually requires root privileges such as iptables, reboot,…
  • /etc – Configuration Files: Local system configuration files. Configuration files for installed applications may be saved here as well. 
  • /dev – Device Files: Contains device files to facilitate access to every hardware device attached to the system. Examples: /dev/sda (disk), /dev/tty (terminal).
  • /proc – Process and Kernel Info: Virtual filesystem showing system and process information. 
  • /var – Variable Data: This directory contains variable data files such as log files, email in-boxes, web application related files, cron files, and more.
  • /tmp – Temporary Files: The operating system and many programs use this directory to store temporary files. This directory is generally cleared upon system boot and may be deleted at other times without any warning.
  • /usr – User Programs: Contains executables, libraries, man files, etc.
  • /home – User Directories: Each user gets a personal directory under /home. 
  • /boot – Boot Loader Files: Consists of the static bootloader, kernel executable, and files required to boot the Linux OS.
  • /lib – Essential Libraries: Shared library files that are required for system boot.
  • /opt – Optional Packages:  Optional files such as third-party tools can be saved here.
  • /mnt – Mount Points: Temporary mount point for regular filesystems.

Linux Shell

A Linux terminal, also called a shell or command line, provides a text-based input/output (I/O) interface between users and the kernel for a computer system. The term console is also typical but does not refer to a window but a screen in text mode. In the terminal window, commands can be executed to control the system. We can think of a shell as a text-based GUI in which we enter commands to perform actions like navigating to other directories, working with files, and obtaining information from the system but with way more capabilities.

Terminal emulation is software that emulates the function of a terminal. It allows the use of text-based programs within a graphical user interface (GUI). There are also so-called command-line interfaces (CLI) that run as additional terminals in one terminal. In short, a terminal serves as an interface to the shell interpreter. Terminal emulators are the bridge between the GUI world and the powerful Linux shell, giving users flexibility and efficiency.

Linux supports multiple shells, each with slightly different features. Common ones include:

  • Bourne Shell (sh): Original Unix shell, simple and widely compatible.
  • Bourne Again Shell (bash): Most popular Linux shell; supports scripting, loops, functions, etc.
  • C Shell (Csh): Syntax similar to C language; supports aliases and history.
  • TENEX C Shell (Tcsh): Improved C shell with command-line editing and auto-completion.
  • Korn Shell (Ksh): Combines features of Bourne shell and C shell; powerful scripting.
  • Z Shell (Zsh): Modern shell with advanced features, themes, and plugins.
  • Friendly Interactive Shell (Fish): User-friendly, modern shell with smart suggestions and colors.

I think I’ll wrap up the content for #01 here. Stay tuned for the next posts, where we’ll dive deeper into Linux and start getting our hands dirty with the OS!