Infrastructure. Systems. Automation.

Linux System Engineer / Sysadmin Homelab builder Exploring cloud, monitoring, storage, networking, automation — and whatever else I find interesting along the way.

Linux Sysadmin Essentials — Cron: Scheduling Recurring Tasks

cron is the classic Unix job scheduler. Every enterprise server relies on it — for log rotation, backup scripts, certificate renewal, and housekeeping tasks that must run on a schedule. The crontab Format * * * * * /path/to/command │ │ │ │ │ │ │ │ │ └─── day of week (0-7, 0 and 7 = Sunday) │ │ │ └───────── month (1-12) │ │ └─────────────── day of month (1-31) │ └───────────────────── hour (0-23) └─────────────────────────── minute (0-59) Common Schedules */5 * * * * /script.sh # every 5 minutes 0 * * * * /script.sh # at the top of every hour 0 2 * * * /script.sh # daily at 2:00 AM 0 2 * * 0 /script.sh # weekly at 2:00 AM on Sundays 0 2 1 * * /script.sh # monthly at 2:00 AM on the 1st 0 2 1 1 * /script.sh # yearly at 2:00 AM on January 1st 30 4 15 * * /script.sh # 4:30 AM on the 15th of every month 0 9-17 * * 1-5 /script.sh # every hour, 9 AM to 5 PM, weekdays 0 */4 * * * /script.sh # every 4 hours Managing Crontabs crontab -l # list your current crontab crontab -e # edit your crontab (uses $EDITOR) crontab -r # remove your crontab (DANGER: no confirmation) crontab -u mtnjng -l # view another user's crontab (root only) System-Wide Crontabs Beyond per-user crontabs, Linux has system-level scheduling: ...

June 17, 2026 · 4 min

Linux Sysadmin Essentials — systemd Services: Managing What Runs

systemd is the init system and service manager on every modern enterprise Linux distribution. You interact with it through systemctl. Service Lifecycle Commands systemctl start nginx # start a service now systemctl stop nginx # stop a service now systemctl restart nginx # stop + start systemctl reload nginx # reload config without dropping connections systemctl enable nginx # auto-start on boot systemctl disable nginx # don't auto-start on boot systemctl status nginx # health check + recent logs systemctl is-active nginx # returns "active" or "inactive" systemctl is-enabled nginx # returns "enabled", "disabled", or "static" systemctl mask nginx # prevent the service from being started at all systemctl unmask nginx # undo mask systemctl daemon-reload # reload unit files after editing them Understanding systemctl status Output systemctl status sshd ● sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2026-06-02 10:00:00 +08; 4h 30min ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 1234 (sshd) Tasks: 1 (limit: 4915) Memory: 1.2M CGroup: /system.slice/sshd.service └─1234 /usr/sbin/sshd -D The key lines are Loaded (is it enabled at boot?) and Active (is it running now?). A service can be active (exited) — meaning the process ran and exited cleanly, common for one-shot tasks. ...

June 16, 2026 · 3 min

Linux Sysadmin Essentials — Time: Clocks, Zones, and NTP Sync

Accurate time is non-negotiable in distributed systems. Log correlation, TLS certificate validation, database replication, and authentication protocols (Kerberos) all depend on synchronized clocks. The Two Clocks Clock Where It Lives Survives Reboot? System clock (software) Kernel memory No — resets from hardware clock on boot Hardware clock (RTC) Motherboard (CMOS battery) Yes date # system clock hwclock # hardware clock (requires root) timedatectl # both clocks, plus NTP status (systemd) timedatectl — One Command to Rule Them All timedatectl status # Local time: Mon 2026-06-02 14:30:00 +08 # Universal time: Mon 2026-06-02 06:30:00 UTC # RTC time: Mon 2026-06-02 06:30:00 # Time zone: Asia/Singapore (+08, +0800) # System clock synchronized: yes # NTP service: active # RTC in local TZ: no Setting Time and Date timedatectl set-time "2026-06-02 14:30:00" # set both date and time timedatectl set-timezone Asia/Singapore # set timezone timedatectl set-ntp true # enable NTP sync timedatectl set-local-rtc false # RTC in UTC (recommended) Always keep the hardware clock in UTC (set-local-rtc false). Local-time RTC causes chaos during DST transitions and dual-boot systems. ...

June 15, 2026 · 2 min

Linux Sysadmin Essentials — Hostname: Your Server's Identity

The hostname is how a server identifies itself on the network and in its own shell prompt. In enterprise environments, hostnames encode function, location, and environment. Viewing and Setting hostname # show current hostname hostnamectl # show full hostname details (systemd) cat /etc/hostname # persistent hostname config hostname -i # IP address the hostname resolves to hostname -f # FQDN (fully qualified domain name) Setting the Hostname (Persistent) hostnamectl set-hostname web-prod-01.example.com This updates /etc/hostname and the running kernel’s hostname atomically. Prefer hostnamectl over manually editing files on systemd systems. ...

June 14, 2026 · 2 min

Linux Sysadmin Essentials — The Filesystem Hierarchy

Every enterprise Linux system follows the Filesystem Hierarchy Standard (FHS). Knowing what belongs where is the difference between a maintainable server and a scavenger hunt. Key Directories and Their Purpose Directory Purpose Enterprise Notes / Root — everything hangs off here Never run out of inodes on / /bin Essential user binaries (symlink to /usr/bin on modern distros) ls, cp, bash /sbin System administration binaries (symlink to /usr/sbin) fdisk, iptables, mkfs /usr User system resources — the bulk of installed software Largest tree on most systems /usr/local Locally compiled / manually installed software Survives OS upgrades; your territory /etc Host-specific configuration files Back this up religiously /var Variable data — logs, spools, caches, databases logrotate your /var/log /tmp Temporary files, cleared on reboot World-writable; never store anything that matters /opt Optional / third-party application software Common for vendor packages (Google, Splunk, etc.) /home User home directories Mount on a separate partition or volume /boot Kernel images, initramfs, bootloader config Don’t let this fill up; old kernels pile up /proc Virtual filesystem — kernel and process info cat /proc/cpuinfo, cat /proc/meminfo /sys Virtual filesystem — kernel, devices, drivers echo 1 > /sys/block/sda/device/rescan /dev Device files /dev/sda, /dev/null, /dev/urandom /run In-memory runtime data tmpfs, wiped on reboot; PID files live here now /srv Data served by the system Web roots, FTP data, Git repositories The /usr Merge Modern distributions (RHEL 8+, Fedora, Ubuntu 20.04+) have merged /bin → /usr/bin and /sbin → /usr/sbin via symlinks. If you write scripts that hardcode /bin/bash, it still works — the symlink resolves it. ...

June 13, 2026 · 2 min

Linux Sysadmin Essentials — PATH: How Linux Finds Your Commands

When you type python, nginx, or kubectl, the shell does not magically know where the binary lives. It searches a colon-separated list of directories stored in the PATH environment variable. Viewing Your PATH echo $PATH # /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mtnjng/.local/bin The shell checks each directory in order and runs the first match. This ordering is critical — a binary in /usr/local/bin takes priority over the same-named binary in /usr/bin. How the Shell Resolves Commands which python3 # shows which binary would run type python3 # shows whether it's a binary, alias, or function whereis python3 # shows binary, source, and man page locations command -v python3 # POSIX-compliant, safe for scripts Command Purpose Script-Safe? which Returns the first matching executable path No (external, may vary) type Tells you what a command is (alias, function, binary) No (bash builtin) command -v Prints path or alias definition Yes — POSIX, reliable whereis Locates binary, source, and man page No Always use command -v in scripts to check if a program is available: ...

June 12, 2026 · 2 min

Linux System Administration Essentials

Running a Linux server in production means knowing more than just navigating the filesystem. You need to understand how the system finds executables, how it tracks time, how services start and stop, and how scheduled jobs keep the gears turning. This series covers six foundational pillars of Linux system administration — the things you reach for daily when managing servers, debugging failures, or hardening a deployment. Each part goes deep on a single topic with practical commands, enterprise context, and production-grade pro tips. ...

June 11, 2026 · 2 min

Linux File Processing — Production Workflows

The production tier is about discipline, not new commands. It is about applying file-processing tools in a way that survives audit, avoids outages, and keeps you sane during 3 AM incidents. File Metadata — stat stat /etc/ssh/sshd_config # File: /etc/ssh/sshd_config # Size: 3905 # Access: (0600/-rw-------) Uid: (0/root) Gid: (0/root) # Modify: 2026-05-28 09:15:00.000000000 +0800 # Change: 2026-05-28 09:15:00.000000000 +0800 The Change timestamp reflects metadata updates — including SELinux context changes, chmod, and chown. Important for audit trails. ...

June 10, 2026 · 3 min

Linux File Processing — Comparing Files

Before applying a config change in production, verify it with diff. This post covers file comparison tools and the text-processing pipeline utilities. diff — Systematic Comparison diff /etc/ssh/sshd_config /etc/ssh/sshd_config.bak diff -u /etc/ssh/sshd_config /etc/ssh/sshd_config.bak # Unified (readable) diff -y /etc/ssh/sshd_config /etc/ssh/sshd_config.bak # Side-by-side Output: 3c3 # Line 3 changed < #Port 22 --- > Port 2222 5a6 # Line added after line 5 > MaxAuthTries 3 8d9 # Line 8 deleted < PermitEmptyPasswords yes Capture the diff as evidence: ...

June 9, 2026 · 1 min