infx 451 8,9,10
1. Managing Services with systemd
Most modern Linux distributions use systemd for system initialization and service management, replacing legacy methods like SysVinit.
Unit Files
Unit files define how systemd manages resources. They use a specific suffix to identify their type:
.service: Represents processes managed by systemd..timer: Manages time-based events and intervals..mount: Manages mount points in the filesystem..target: Groups units to represent system startup configurations (e.g.,multi-user.target,graphical.target).
Essential systemctl Commands
The systemctl command is your primary tool for managing these units.
Start/Stop: Runs or stops a service for the current session.
Enable/Disable: Configures whether a service starts automatically at boot.
Mask: Prevents a service from being started at all by linking it to
/dev/null.Status: Checks the current state of a service.
2. Common System Services
Linux administrators must frequently configure several core services:
Time Management
Systems use a hardware clock (BIOS) and software system time. To keep networked systems synchronized, you can use:
NTP (ntpd): Standard Network Time Protocol.
Chrony (chronyd): A flexible and consistent synchronization service.
PTP: Precision Time Protocol, used for high-accuracy needs.
Task Scheduling
cron: Best for recurring tasks; it assumes the system is always running.
at: Used for tasks that need to run exactly once.
anacron: Ideal for systems that are frequently powered down; it runs missed jobs after startup.
File Sharing & Web
Webservers: Common programs include Apache (
httpd) and nginx.NFS: Used for remote connections between Linux systems.
Samba: Allows Linux systems to use SMB to interact with Windows clients and Active Directory.
Printing: Managed via CUPS, which provides a web-based interface for administration.
3. Localization and Troubleshooting
Localization adapts the system for specific languages, cultures, and time zones.
timedatectl: Used to set the system time and time zone.localectl: Used to set the locale (language/encoding) and keyboard layout.date: Displays or changes the current system time.Time Zone Info: Time zones are stored in
/usr/share/zoneinfo/. On Debian-based systems, the active time zone is listed in/etc/timezone.
Quick Comparison: systemctl vs sysctl
It is easy to confuse these two commands:
Command | Purpose |
| Modifies service and daemon behavior. |
| Manages kernel modules and parameters. |
1. Gathering Hardware Information
To manage a server, you must first understand the physical and virtual hardware it’s running on.
Server Architectures
AArch64: 64-bit architecture known for high performance and low power consumption; popular in cloud and IoT.
x86_64 / AMD64: The 64-bit extension of the legacy 32-bit x86 architecture. It is the default for most Linux server deployments.
RISC-V: An open-source, modular architecture gaining popularity in research but currently has limited software support.
GPUs: Used for AI and high-performance computing (HPC); can be monitored using tools like
nvtop.
Key Hardware Commands
Command | Primary Use |
| Provides a concise summary of all hardware. |
| Displays detailed CPU architecture information. |
| Shows details about devices on USB or PCI buses. |
| Gives a detailed report on CPU, memory, and storage. |
| Provides BIOS/Hardware info; use |
| Monitors health like temperature and fan speeds. |
2. Managing Processes
Processes are running instances of programs. Every process is assigned a unique Process ID (PID).
Process States
Linux processes move through several states:
Running: Actively executing.
Sleeping/Blocked: Waiting for a resource or event.
Stopped: Paused (often for debugging).
Zombie: Finished executing but still listed in the process table.
Process Manipulation & Priorities
Signals: You can control processes by sending signals:
SIGTERM (15): Request a "graceful" shutdown.
SIGKILL (9): Forcefully kill a process (risks data loss).
Priorities (Niceness): Priority ranges from -20 (highest) to 19 (lowest).
nice: Sets priority for a new process.renice: Changes priority of a running process.
3. Managing the Linux Kernel
The kernel is the core of the OS that manages communication between hardware and software.
Kernel Space vs. User Space
Kernel Space: Runs core OS functions and services.
User Space: Runs applications (like your browser or terminal). Applications use system calls to request services from the kernel.
Kernel Modules and Parameters
Modules: These are system-level objects that extend kernel functionality (like drivers) without requiring a system reboot.
modprobe: Adds or removes modules.lsmod: Lists currently loaded modules.
Parameters: Located in
/proc/sys/, these allow you to tune the kernel at runtime.sysctl: Used to view or modify these parameters. Changes made here are lost on reboot unless saved in/etc/sysctl.conf.
Troubleshooting
Kernel Panic: A fatal error where the system becomes unstable and stops.
OOM Killer: When the system runs out of memory, the "Out of Memory Killer" chooses a process to terminate to save the system.
Gemini said
Based on the provided Linux+ XK0-006 Module 10 materials, here is a structured study guide to help you master configuring and troubleshooting network settings.
## 1. Networking Fundamentals
Understanding how Linux identifies and interacts with network devices is the first step.
+1
TCP/IP Layers: Linux network communications are governed by four layers: Application (e.g., HTTP), Transport (e.g., TCP/UDP), Internet (e.g., IP), and Network Access (e.g., Ethernet) .
Network Identities:
MAC Address: A hardcoded physical address on the NIC .
IP Address: A logical address assigned to the NIC .
Hostname: A human-readable descriptive name .
Common Ports to Memorize:
22: SSH
25: SMTP
80: HTTP
123: NTP
143: IMAP4
443: HTTPS
## 2. Managing Network Settings
Linux provides several utilities to configure interfaces and resolve names.
### Configuration Interfaces
NetworkManager: The primary utility for configuring IP information . It includes
nmcli(command line),nmtui(text-based visual interface), and the GNOME applet (GUI) .+1
Netplan: Uses YAML files in
/etc/netplanto manage settings . Key commands includenetplan tryto test andnetplan applyto enforce changes .+1
Legacy/Specific Tools:
ifconfig(deprecated) for IP info andiwconfigfor wireless SSID/encryption .
### Name Resolution
Files to Know:
/etc/hosts: Maps IP addresses to names locally (used for small networks or testing) .+1
/etc/resolv.conf: Informs the system of DNS server IP addresses ./etc/nsswitch.conf: Defines the order of resolution (standard is/etc/hostsfirst, then DNS) .
## 3. Remote Administration & Data Transfer
Secure Shell (SSH) is the standard for remote Linux administration .
SSH Configs: Client settings are in
/etc/ssh/ssh_config, while server settings are in/etc/ssh/sshd_config.Key-based Authentication: More secure than passwords . Use
ssh-keygento create a pair andssh-copy-idto transfer the public key to a remote host .+1
Data Transfer Tools:
scp: Simple data copying over SSH .sftp: Manages files over SSH; supports resuming interrupted transfers .rsync: Efficiently copies only modified files .wget/curl: Download files from web servers via CLI .
## 4. Firewall Management
Linux firewalls filter traffic to protect hosts and networks .
+1
Management Tools:
firewalld: Dynamically manages rules using "zones" and "services" . Use
firewall-cmdfor configuration.+1
UFW (Uncomplicated Firewall): Best for home or non-technical users.
+1
iptables/nftables: Provide granular control for complex setups.
nftablesis the modern replacement foriptables.+1
Fail2Ban: An automated tool that monitors logs (like
/var/log/auth.log) and updates firewall rules to block suspicious behavior .
## 5. Monitoring & Troubleshooting
When the network fails, use these tools to find the bottleneck .
Tool | Primary Purpose |
|---|---|
| Tests basic connectivity and identifies timeouts. |
| Identifies each "hop" (router) to find where a path fails . |
| Combines |
| Displays real-time bandwidth usage by NIC or protocol . |
| Tests maximum throughput and identifies random timeouts . |
| Shows socket states, listening ports, and established connections . |
| Scans subnets to map the network and find open/filtered ports . |
Export to Sheets