$npx -y skills add ancoleman/ai-design-components --skill administering-linuxManage 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.
| 1 | # Linux Administration |
| 2 | |
| 3 | Comprehensive Linux system administration for managing servers, deploying applications, and troubleshooting production issues in modern cloud-native environments. |
| 4 | |
| 5 | ## Purpose |
| 6 | |
| 7 | 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. |
| 8 | |
| 9 | 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. |
| 10 | |
| 11 | **Not Covered:** |
| 12 | - Advanced networking (BGP, OSPF) - see `network-architecture` skill |
| 13 | - Deep security hardening (compliance, pentesting) - see `security-hardening` skill |
| 14 | - Configuration management at scale (Ansible, Puppet) - see `configuration-management` skill |
| 15 | - Container orchestration - see `kubernetes-operations` skill |
| 16 | |
| 17 | ## When to Use This Skill |
| 18 | |
| 19 | 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. |
| 20 | |
| 21 | ## Quick Start |
| 22 | |
| 23 | ### Essential Commands |
| 24 | |
| 25 | **Service Management:** |
| 26 | ```bash |
| 27 | systemctl start nginx # Start service |
| 28 | systemctl stop nginx # Stop service |
| 29 | systemctl restart nginx # Restart service |
| 30 | systemctl status nginx # Check status |
| 31 | systemctl enable nginx # Enable at boot |
| 32 | journalctl -u nginx -f # Follow service logs |
| 33 | ``` |
| 34 | |
| 35 | **Process Monitoring:** |
| 36 | ```bash |
| 37 | top # Interactive process monitor |
| 38 | htop # Enhanced process monitor |
| 39 | ps aux | grep process_name # Find specific process |
| 40 | kill -15 PID # Graceful shutdown (SIGTERM) |
| 41 | kill -9 PID # Force kill (SIGKILL) |
| 42 | ``` |
| 43 | |
| 44 | **Disk Usage:** |
| 45 | ```bash |
| 46 | df -h # Filesystem usage |
| 47 | du -sh /path/to/dir # Directory size |
| 48 | ncdu /path # Interactive disk analyzer |
| 49 | ``` |
| 50 | |
| 51 | **Log Analysis:** |
| 52 | ```bash |
| 53 | journalctl -f # Follow all logs |
| 54 | journalctl -u service -f # Follow service logs |
| 55 | journalctl --since "1 hour ago" # Filter by time |
| 56 | journalctl -p err # Show errors only |
| 57 | ``` |
| 58 | |
| 59 | **User Management:** |
| 60 | ```bash |
| 61 | useradd -m -s /bin/bash username # Create user with home dir |
| 62 | passwd username # Set password |
| 63 | usermod -aG sudo username # Add to sudo group |
| 64 | userdel -r username # Delete user and home dir |
| 65 | ``` |
| 66 | |
| 67 | ## Core Concepts |
| 68 | |
| 69 | ### Systemd Architecture |
| 70 | |
| 71 | Systemd is the standard init system and service manager. Systemd units define services, timers, targets, and other system resources. |
| 72 | |
| 73 | **Unit File Locations (priority order):** |
| 74 | - `/etc/systemd/system/` - Custom units (highest priority) |
| 75 | - `/run/systemd/system/` - Runtime units (transient) |
| 76 | - `/lib/systemd/system/` - System-provided units (don't modify) |
| 77 | |
| 78 | **Key Unit Types:** `.service` (services), `.timer` (scheduled tasks), `.target` (unit groups), `.socket` (socket-activated) |
| 79 | |
| 80 | **Essential systemctl Commands:** |
| 81 | ```bash |
| 82 | systemctl daemon-reload # Reload unit files after changes |
| 83 | systemctl list-units --type=service |
| 84 | systemctl list-timers # Show all timers |
| 85 | systemctl cat nginx.service # Show unit file content |
| 86 | systemctl edit nginx.service # Create override file |
| 87 | ``` |
| 88 | |
| 89 | For detailed systemd reference, see `references/systemd-guide.md`. |
| 90 | |
| 91 | ### Process Management |
| 92 | |
| 93 | Processes are running programs with unique PIDs. Understanding process states, signals, and resource usage is essential for troubleshooting. |
| 94 | |
| 95 | **Process States:** R (running), S (sleeping), D (uninterruptible sleep/I/O), Z (zombie), T (stopped) |
| 96 | |
| 97 | **Common Signals:** SIGTERM (15) graceful, SIGKILL (9) force, SIGHUP (1) reload config |
| 98 | |
| 99 | **Process Priority:** |
| 100 | ```bash |
| 101 | nice -n 10 command # Start with lower priority |
| 102 | renice -n 5 -p PID # Change priority of running process |
| 103 | ``` |
| 104 | |
| 105 | ### Filesystem Hierarchy |
| 106 | |
| 107 | Essential directories: `/` (root), `/etc/` (config), `/var/` (variable data), `/opt/` (optional software), `/usr/` (user programs), `/home/` (user directories), `/tmp/` (temporary), `/boot/` (boot loader) |
| 108 | |
| 109 | **Filesystem Types Quick Reference:** |
| 110 | - **ext4** - General purpose (default) |
| 111 | - **XFS** - Large files, databases (RHEL default) |
| 112 | - **Btrfs** - Sn |