DEV Community

Samkeliso Dube
Samkeliso Dube

Posted on

Linux Architecture for Beginners: Understanding the Layers Behind the Commands

When I started learning Linux, I wanted to understand what it is and why it is important in DevOps.

After exploring the basics, my next step was to understand Linux architecture.

We often use Linux commands to create directories, manage files, install software, and check services. But have you ever wondered what happens behind the scenes when you type a command into the terminal?

In this article, I'll explain the basic layers of Linux architecture and how they work together.

What Is Linux Architecture?

Linux architecture describes how the different components of a Linux system work together to make the operating system function.

These components have different responsibilities. Some manage hardware resources, while others allow users to interact with the system and run applications.

For beginners, we can understand Linux architecture through four main layers:

  1. Hardware
  2. Kernel
  3. Shell and system utilities
  4. Applications

linux-Architecture

Let's explore each one.

1. Hardware: The Physical Resources

Hardware refers to the physical components of a computer.

Examples include:

  • CPU: Executes instructions.
  • RAM: Holds data and programs that are currently in use.
  • Storage: Stores the operating system, applications, and files.
  • Network interface: Allows the computer to communicate over a network.

Linux needs to manage these resources so that applications can run properly.

For example, when you open a program, it needs memory and CPU time. Linux helps manage access to these resources.

2. The Kernel: The Core of Linux

The kernel is the core component of the Linux operating system.

It manages the computer's resources and provides the interface between software and hardware.

Some of its responsibilities include:

  • Process management: Managing running programs and their execution.
  • Memory management: Allocating and managing memory.
  • Device management: Coordinating access to hardware devices.
  • Filesystem management: Supporting access to files and storage.
  • Networking: Providing networking capabilities for communication between computers.

For example, when you run a command that reads a file, the program requests access to that file through operating-system interfaces. The kernel helps manage the underlying operations.

As a beginner, remember this: the kernel helps software use the computer's resources safely and efficiently.

3. The Shell and System Utilities

The shell allows us to interact with the operating system by entering commands.

On Ubuntu, a common shell is Bash.

For example, when I open my terminal and type:

pwd
Enter fullscreen mode Exit fullscreen mode

The command prints the path of my current working directory.

When I type:

ls
Enter fullscreen mode Exit fullscreen mode

It lists the files and directories in that location.

Other useful commands include:

  • cd changes the current directory.
  • mkdir creates a directory.
  • cat displays the contents of a file.

These commands are provided by system utilities or other programs, and the shell helps interpret and execute the commands we enter.

Is the Terminal the Same as the Shell?

Not exactly.

The terminal is the interface where we enter and see text. The shell is the program that interprets the commands we type.

Think of the terminal as the place where you communicate and the shell as the program that understands your instructions.

4. Applications

Applications are programs that perform tasks for users or other software.

Examples include:

  • Nginx, a web server.
  • MySQL, a database management system.
  • Docker, a platform for running applications in containers.
  • Text editors and browsers.

Applications rely on operating-system services and resources to do their work.

For example, Nginx can serve web pages to visitors. Linux provides the networking and other system resources that Nginx needs to operate.

How Do These Layers Work Together?

Let's use a simple example.

Imagine that I open a Linux terminal and type:

ls
Enter fullscreen mode Exit fullscreen mode

Here is a simplified explanation of what happens:

  1. I enter the command in the terminal.
  2. The shell interprets the command and runs the ls program.
  3. The program requests information about the directory.
  4. The kernel helps provide access to the filesystem and the required information.
  5. The program displays the results in the terminal.

This example shows that even a simple command relies on different components working together.

Where Do Daemons Fit Into Linux Architecture?

After exploring the main layers of Linux architecture, I wanted to understand where background services fit into the picture.

The kernel manages system resources, while applications use those resources to perform different tasks. However, not everything on a Linux system requires a user to open a terminal and run a command.

This is where daemons come in.

A daemon is a process that runs in the background to provide a service or perform tasks. Daemons rely on the Linux kernel to access system resources and carry out their work.

For example:

  • sshd handles incoming SSH connections.
  • cron runs scheduled tasks.
  • nginx can run in the background to serve web pages.

To explore this practically, I checked the status of the cron service on my Ubuntu system:

systemctl status cron
Enter fullscreen mode Exit fullscreen mode

The output showed:

Active: active (running)
Enter fullscreen mode Exit fullscreen mode

This told me that the cron service was running at the time I checked it.

This helped me connect the theory to practice. Daemons are not a separate architectural layer; they are background processes that rely on the kernel and other system components to perform their tasks.

Why does this matter in DevOps?

When an application or service fails on a Linux server, knowing how to check its status and understand how background processes work gives us a starting point for troubleshooting.

I'm learning that Linux is not just about the commands we enter. It's also about understanding the processes and services working behind the scenes.

Final Thoughts

Today, I explored Linux architecture and learned how hardware, the kernel, the shell, system utilities, and applications work together.

I also explored daemons and how background services help a Linux system perform tasks without requiring constant interaction from the user.

I'm beginning to understand that building a strong DevOps foundation means knowing not just which command to run, but also what happens behind the scenes.

This is another step in my journey of rebuilding my DevOps knowledge, one concept at a time.

If you're also learning Linux, I'd love to hear: **Which Linux concept took you some time to understand when you first started?

Linux #DevOps #CloudEngineering #LearningInPublic

Top comments (0)