Understand Linux logging system and Job Control

Linux system administration is the process of managing and maintaining the core components of a Linux operating system. This includes controlling services (also called daemons), managing system processes, configuring startup behavior, and understanding how the system boots. Whether you are working on a server, a desktop, or a virtual machine, these tasks are central to keeping your Linux system stable, efficient, and secure.

In this article, you will learn how to manage system services using the systemctl tool, how the boot process works, what systemd does, and how to control background tasks and jobs. These skills form the backbone of real-world system administration in any Linux environment.

If you are just starting out, consider reading our previous articles on Users, Groups & Permissions and Software & Package Management to build a solid foundation. Once you understand access control and package tools, managing system services becomes much easier.

Understanding Linux Services and Daemons

A service (or daemon) in Linux is a background process that runs without direct user interaction. Examples include the network manager, SSH server, cron scheduler, and printing system. These services often start automatically when the system boots and continue running in the background.

Services are managed using the systemd system manager, which handles startup, background jobs, and logging. Each service has a corresponding unit file that defines how it runs and what it depends on.

For example, the SSH service runs in the background to allow remote connections. If it fails or is not configured correctly, users may not be able to connect remotely to the machine.


systemctl: The Tool to Manage Linux Services

The systemctl command is used to manage services on systems that use systemd, which includes most modern Linux distributions such as Ubuntu, Fedora, Debian, and CentOS.

Here are basic commands to control services:

# Start a service
sudo systemctl start apache2

# Stop a service
sudo systemctl stop apache2

# Restart a service
sudo systemctl restart apache2

# Check the status of a service
sudo systemctl status apache2

# Enable a service to start at boot
sudo systemctl enable apache2

# Disable a service from starting at boot
sudo systemctl disable apache2

You can replace apache2 with any service name on your system, such as ssh, cron, or NetworkManager.

To list all active services:

systemctl list-units --type=service
List Active Services
List Active Services

This command helps you see which services are currently running or failed.


What Is systemd?

systemd is a system and service manager for Linux. It is the first process that runs when the system starts and continues to run until the system shuts down. It replaces older init systems like SysVinit and Upstart, providing faster boot times and more consistent management tools.

systemd uses unit files to define services, sockets, timers, and targets. It also handles process supervision, logging (through journald), and dependency tracking during startup.

To check if your system uses systemd:

ps -p 1 -o comm=
Linux Mint Uses Systemd
Linux Mint Uses Systemd

If it returns systemd, your system is using it as the init system. Nearly all modern Linux distributions do.

Understanding the Linux Boot Process

The Linux boot process follows a series of steps from powering on the machine to reaching a usable shell or graphical interface. These are the key stages:

  1. BIOS/UEFI: Initializes hardware and finds the bootloader.
  2. Bootloader (GRUB): Loads the kernel into memory.
  3. Kernel Initialization: Starts the kernel and sets up low-level functions.
  4. init/systemd: The kernel hands over control to the init system (systemd on modern systems).
  5. Target or Runlevel Reached: The system starts services and user interfaces.

If there is an issue during boot, it usually occurs in steps 3 to 5. Understanding these steps helps in diagnosing slow startups or broken services.


Runlevels and systemd Targets

Older Linux systems used runlevels to define system states like single-user mode, multi-user mode, and graphical mode. With systemd, these have been replaced by targets, which serve a similar function but with more flexibility.

Common systemd targets include:

  • multi-user.target: Equivalent to runlevel 3, used for non-GUI servers.
  • graphical.target: Equivalent to runlevel 5, includes GUI support.
  • rescue.target: Used for single-user mode with minimal services.
  • default.target: The default target the system boots into.

You can check your current target with:

systemctl get-default

To change the default target (for example, to boot into a non-graphical environment):

sudo systemctl set-default multi-user.target

You can also switch targets without rebooting:

sudo systemctl isolate rescue.target

This command brings the system into rescue mode immediately.


Process Management in Linux

A process is any program that is running on your system. You can view, monitor, and control processes using various commands.

To see running processes, use:

ps aux

Or use the interactive tool:

top

Instead of top, people also use Htop and Btop now, but those usually are not installed on the system.

Htop Running
Htop Running

If a process becomes unresponsive, you can stop it with the kill command:

kill PID

Replace PID with the process ID. If the process does not respond, use:

kill -9 PID

To find the PID of a process, you can use:

pidof firefox
Killing Firefox Process
Killing Firefox Process

For better visual monitoring, install and use htop, a more readable alternative to top.


Job Control in Linux

Job control allows you to manage foreground and background tasks in the shell. This is useful when you want to pause or continue processes without closing your terminal.

To run a command in the background, use an &:

sudo apt update &

To pause a running job (e.g. using Ctrl + Z) and move it to the background:

bg

To bring it back to the foreground:

fg

To see all jobs in the current terminal:

jobs

To kill a background job, find its job ID using jobs, then use:

kill %1

These tools are useful when you are multitasking in the terminal or running tasks that take time to complete.


Summary

In this article, you have learned the core components of Linux system administration. You now understand how services and daemons work, how to use systemctl to start or stop services, and how systemd manages the system from the moment it boots. You also explored how runlevels have evolved into targets, how to manage processes and jobs, and how to troubleshoot and monitor system behavior effectively.

This knowledge is important for anyone running a Linux server, working in DevOps, or managing systems in a professional environment. If you have not already, be sure to review our articles on File Permissions and Ownership and Disk Management with LVM and RAID, which are key parts of keeping your system secure and functional.

Now that you understand how services and processes are managed, the next article will focus on Linux Security and Access Control, so keep an eye out for that one!