administering-linux
Manage Linux systems covering systemd services, process management, filesystems, networking, performance tuning, and troubleshooting. Use when deploying applications, optimizing server performance, diagnosing production issues, or managing users and security on Linux servers.
What this skill does
# Linux Administration Comprehensive Linux system administration for managing servers, deploying applications, and troubleshooting production issues in modern cloud-native environments. ## Purpose This skill teaches fundamental and intermediate Linux administration for DevOps engineers, SREs, backend developers, and platform engineers. Focus on systemd-based distributions (Ubuntu, RHEL, Debian, Fedora) covering service management, process monitoring, filesystem operations, user administration, performance tuning, log analysis, and network configuration. Modern infrastructure requires solid Linux fundamentals even with containerization. Container hosts run Linux, Kubernetes nodes need optimization, and troubleshooting production issues requires understanding systemd, processes, and logs. **Not Covered:** - Advanced networking (BGP, OSPF) - see `network-architecture` skill - Deep security hardening (compliance, pentesting) - see `security-hardening` skill - Configuration management at scale (Ansible, Puppet) - see `configuration-management` skill - Container orchestration - see `kubernetes-operations` skill ## When to Use This Skill Use when deploying custom applications, troubleshooting slow systems, investigating service failures, optimizing workloads, managing users, configuring SSH, monitoring disk space, scheduling tasks, diagnosing network issues, or applying performance tuning. ## Quick Start ### Essential Commands **Service Management:** ```bash systemctl start nginx # Start service systemctl stop nginx # Stop service systemctl restart nginx # Restart service systemctl status nginx # Check status systemctl enable nginx # Enable at boot journalctl -u nginx -f # Follow service logs ``` **Process Monitoring:** ```bash top # Interactive process monitor htop # Enhanced process monitor ps aux | grep process_name # Find specific process kill -15 PID # Graceful shutdown (SIGTERM) kill -9 PID # Force kill (SIGKILL) ``` **Disk Usage:** ```bash df -h # Filesystem usage du -sh /path/to/dir # Directory size ncdu /path # Interactive disk analyzer ``` **Log Analysis:** ```bash journalctl -f # Follow all logs journalctl -u service -f # Follow service logs journalctl --since "1 hour ago" # Filter by time journalctl -p err # Show errors only ``` **User Management:** ```bash useradd -m -s /bin/bash username # Create user with home dir passwd username # Set password usermod -aG sudo username # Add to sudo group userdel -r username # Delete user and home dir ``` ## Core Concepts ### Systemd Architecture Systemd is the standard init system and service manager. Systemd units define services, timers, targets, and other system resources. **Unit File Locations (priority order):** - `/etc/systemd/system/` - Custom units (highest priority) - `/run/systemd/system/` - Runtime units (transient) - `/lib/systemd/system/` - System-provided units (don't modify) **Key Unit Types:** `.service` (services), `.timer` (scheduled tasks), `.target` (unit groups), `.socket` (socket-activated) **Essential systemctl Commands:** ```bash systemctl daemon-reload # Reload unit files after changes systemctl list-units --type=service systemctl list-timers # Show all timers systemctl cat nginx.service # Show unit file content systemctl edit nginx.service # Create override file ``` For detailed systemd reference, see `references/systemd-guide.md`. ### Process Management Processes are running programs with unique PIDs. Understanding process states, signals, and resource usage is essential for troubleshooting. **Process States:** R (running), S (sleeping), D (uninterruptible sleep/I/O), Z (zombie), T (stopped) **Common Signals:** SIGTERM (15) graceful, SIGKILL (9) force, SIGHUP (1) reload config **Process Priority:** ```bash nice -n 10 command # Start with lower priority renice -n 5 -p PID # Change priority of running process ``` ### Filesystem Hierarchy Essential directories: `/` (root), `/etc/` (config), `/var/` (variable data), `/opt/` (optional software), `/usr/` (user programs), `/home/` (user directories), `/tmp/` (temporary), `/boot/` (boot loader) **Filesystem Types Quick Reference:** - **ext4** - General purpose (default) - **XFS** - Large files, databases (RHEL default) - **Btrfs** - Snapshots, copy-on-write - **ZFS** - Enterprise, data integrity, NAS For filesystem management details including LVM and RAID, see `references/filesystem-management.md`. ### Package Management **Ubuntu/Debian (apt):** ```bash apt update && apt upgrade # Update system apt install package # Install package apt remove package # Remove package apt search keyword # Search packages ``` **RHEL/CentOS/Fedora (dnf):** ```bash dnf update # Update all packages dnf install package # Install package dnf remove package # Remove package dnf search keyword # Search packages ``` Use native package managers for system services; snap/flatpak for desktop apps and cross-distro compatibility. ## Decision Frameworks ### Troubleshooting Performance Issues **Investigation Workflow:** 1. **Identify bottleneck:** ```bash top # Quick overview uptime # Load averages ``` 2. **CPU Issues (usage >80%):** ```bash top # Press Shift+P to sort by CPU ps aux --sort=-%cpu | head ``` 3. **Memory Issues (swap used):** ```bash free -h # Memory usage top # Press Shift+M to sort by memory ``` 4. **Disk I/O Issues (high wa%):** ```bash iostat -x 1 # Disk statistics iotop # I/O by process ``` 5. **Network Issues:** ```bash ss -tunap # Active connections iftop # Bandwidth monitor ``` For comprehensive troubleshooting, see `references/troubleshooting-guide.md`. ### Filesystem Selection **Quick Decision:** - **Default/General** → ext4 - **Database servers** → XFS - **Large file storage** → XFS or ZFS - **NAS/File server** → ZFS - **Need snapshots** → Btrfs or ZFS ## Common Workflows ### Creating a Systemd Service **Step 1: Create unit file** ```bash sudo nano /etc/systemd/system/myapp.service ``` **Step 2: Unit file content** ```ini [Unit] Description=My Web Application After=network.target postgresql.service Requires=postgresql.service [Service] Type=simple User=myapp Group=myapp WorkingDirectory=/opt/myapp Environment="PORT=8080" ExecStart=/opt/myapp/bin/server ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure RestartSec=5s StandardOutput=journal # Security hardening PrivateTmp=true NoNewPrivileges=true ProtectSystem=strict ReadWritePaths=/var/lib/myapp [Install] WantedBy=multi-user.target ``` **Step 3: Deploy and start** ```bash sudo useradd -r -s /bin/false myapp sudo mkdir -p /var/lib/myapp sudo chown myapp:myapp /var/lib/myapp sudo systemctl daemon-reload sudo systemctl enable myapp.service sudo systemctl start myapp.service sudo systemctl status myapp.service ``` For complete examples, see `examples/systemd-units/`. ### Systemd Timer (Cron Replacement) Create service and timer units for scheduled tasks. Timer unit specifies `OnCalendar=` schedule and `Persistent=true` for missed jobs. Service unit has `Type=oneshot`. See `examples/systemd-units/backup.timer` and `backup.service` for complete examples. ### SSH Hardening **Generate SSH key:** ```bash ssh-keygen -t ed255
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.