DEV Community

Cover image for Linux basics for Cloud/DevOps Engineer
Waser Al Karim
Waser Al Karim

Posted on

Linux basics for Cloud/DevOps Engineer

Linux is an open-source Unix like operating system kernel that serves as a baseline for various Linux distributions. Due to its stability, security, and flexibility. It is widely used in DevOps, Cloud, Servers etc.

Why Linux is so popular!

  1. Open Source: Free to use and modify.
  2. Multi-User & Multi-Tasking: Supports multiple users and processes at once.
  3. Secure & Stable: Strong security and rarely crashes.
  4. Customizable: Can be modified to suit different needs.
  5. Command-Line Support: Powerful terminal for automation and scripting.

Where is Linux Used?

Runs most web servers. Used for coding and automation. Preferred for ethical hacking and security testing. Used in smart devices and IoT.

Linux Kernel

Kernel is the core component of the Linux. It acts as a bridge between hardware and software, managing system resources like CPU, memory, and devices.

Key Functions:

  • Process Management – Controls running applications.
  • Memory Management – Allocates RAM efficiently.
  • Device Management – Connects hardware like USBs, keyboards, and GPUs.
  • File System Management – Handles data storage and retrieval.
  • Security & Networking – Provides system protection and network communication.

Linux Boot Sequence

When a Linux system is turned on a sequence of steps that occurs. Every step ensures that the system is up and running and it is in usable state.

Kernel Space and User Space

Kernel Space

Kernel Space is a reserved for operating system that runs in a highly trusted mode.

  1. Runs in privileged mode (ring 0).
  2. Directly interacts with hardware CPU, memory, I/O devices.

    1. Handles system calls, memory management, and process scheduling.
  3. Includes kernel modules, device drivers, and system services.

  4. Kernel space code executes in a protected and isolated environment to ensure stability, security, and control over system resources.

Examples: Kernel code & device drivers, Process scheduling and System calls handling

User Space

It is used for running user applications without direct hardware access.

  1. Runs in unprivileged mode (ring 3)
  2. Cannot directly access hardware (must request kernel via system calls)
  3. Provides a safe execution environment for applications
  4. If an application crashes, it won't affect the OS

Examples: Web browsers, text editors, media players, Command-line tools, User-space programs interacting with kernel.

Key Differences

Feature Kernel Space User Space
Access Mode Privileged (Ring 0) Unprivileged (Ring 3)
Direct HW Access Yes No
Stability Impact A crash can bring down the system A crash affects only the app
Example Components Kernel, drivers, system calls Applications, shells, libraries

Linux Desktop vs. Linux Server

Overview

Linux distributions are available for both desktops and servers. While they share the same kernel, they are optimized for different use cases.

Feature Linux Desktop Linux Server
Purpose Designed for personal use, productivity, multimedia Optimized for hosting services, databases, and networking
GUI Has a graphical user interface (GNOME, KDE, etc.) Usually headless (CLI-based) for performance and security
Performance Optimized for user interaction, multitasking Optimized for stability, uptime, and resource efficiency
Software Includes desktop apps (browsers, office suites, media players) Includes server software (Apache, MySQL, Docker, Kubernetes)
Security User-focused security, auto-updates Hardened security, minimal unnecessary services
Power Management Sleep, hibernate, battery optimization Always-on for reliability and uptime
Hardware Supports consumer hardware (GPUs, Wi-Fi, Bluetooth) Supports enterprise hardware (RAID, ECC RAM, headless operation)

Linux Filesystem and Hierarchy

Directory Purpose
/ The root directory. All filesystem structures begin here.
/bin/ Essential user command binaries (ex: ls, cp, mv) needed for system operation in single-user mode.
/boot/ Contains files needed to boot the system, including the Linux kernel and bootloader configurations (like GRUB).
/dev/ Device files representing hardware (ex: /dev/sda, /dev/tty).
/etc/ Host-specific configuration files (ex: network settings, services, users).
/home/ Home directories for regular users (ex: /home/alice, /home/bob).
/lib/ Essential shared libraries and kernel modules needed by binaries in /bin/ and /sbin/.
/media/ Mount points for removable media (USB drives, CDs, etc.).
/mnt/ Temporary mount points for mounting filesystems manually.
/opt/ Optional software packages and add-on application software.
/root/ Home directory for the root (superuser).
/sbin/ Essential system binaries (ex: fsck, reboot) used mainly for system administration.
/srv/ Data for services provided by the system (ex: web server data, FTP data).
/tmp/ Temporary files created by applications; usually cleared on reboot.
/usr/ Secondary hierarchy for read-only user data; contains most user commands, libraries, documentation, and applications.
/usr/bin/ Non-essential user binaries (the majority of user commands).
/usr/lib/ Libraries for programs located in /usr/bin/ and /usr/sbin/.
/usr/include/ Header files for development.
/usr/sbin/ Non-essential system administration binaries.
/var/ Variable files - content expected to change frequently (logs, spool files, caches).
/var/log/ System log files (ex: /var/log/syslog, /var/log/auth.log).
/var/cache/ Cached data from applications.
/var/spool/ Data awaiting processing (ex: print jobs, mail queue).

Package Management Distribution

Package Management system allows us to simplify the process of installation, upgrading, and removal of software packages.

We know that in windows we can install software by double clicking the .exe file but in Linux we have to install software via packages.

Linux Package:

A Linux package is a compressed file that contains software, libraries, and necessary configurations required for installation on a Linux system.

Types of Linux Packages:

  • Debian-based (.deb) – Used in Ubuntu, Debian. It is managed by apt/dpkg (Advanced Package Tool).
  • Red Hat-based (.rpm) – Used in CentOS, Fedora. It is managed by yum/dnf/rpm (Yellowdog Updater Modified).
  • Arch-based (.pkg.tar.zst) – Used in Arch Linux and managed by pacman.

Difference between APT and APT GET

In Debian based system we have both apt and apt get package management tool is available.

APT GET: For many years it was a standard tool for package management. Unfortunately, it has some limitations. For example, it lacks built-in progress indicators and parallel downloading capabilities.

APT: Apt is now the most used package tool for Debian based systems. It is built upon the apt-get functionalities but more refined and includes more functionality such as built-in progress indicators and parallel downloading capabilities.

Difference between APT and DPKG

DPKG:

dpkg is the low-level tool used for installing, removing, and managing .deb packages on Debian-based systems. However, it has some limitations. For example, it does not automatically handle dependencies or fetch packages from online repositories.

APT:

apt is the most used package management tool for Debian-based systems. It is built on top of dpkg but offers more advanced features such as automatic dependency resolution, access to online repositories, built-in progress indicators, and parallel downloading capabilities.

What is Shell?

A shell is a command-line interface that allows users to interact with an operating system by executing commands.

Shell allows us to login into our local or remote servers or systems. Both graphical and text mode consoles are supported.

Here are some of the popular tools for remote login and management in Linux:

  1. MobaXterm
  2. OpenSSH
  3. PuTTY
  4. Terminator
  5. Cockpit
  6. Ansible

SSH into the shell

For these hands on sessions we are going to use the MobaXterm and default terminal as our remote login tool. After installing the Ubuntu Server on the VirtualBox we can SSH onto that server. So first of all, we have to check the ip address of the ubuntu server using this command:

Terminal:

Check the ip of the VM/Instance.

ip a 
Enter fullscreen mode Exit fullscreen mode

Run this command to establish the ssh remote login:

ssh <username>@<ip address> ssh -i <.pem file location> <username>@<ip address> 
Enter fullscreen mode Exit fullscreen mode

MobaXterm:

  1. Click the session button
  2. Then the SSH button
  3. Input the ip address of the server
  4. Press ok the open the ssh session

Thank you for reading this article.

Top comments (0)