Skip to main content
skill CX Codex

linux-administration — Claude Code skill: Linux server admin

A skill for Linux server work: packages, services, disks, processes, cron and logs. Useful when the agent needs to run commands on a server, not just write code.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add BagelHole/DevOps-Security-Agent-Skills --skill linux-administration -a claude-code
Open on GitHub

What linux-administration does

The skill covers everyday sysadmin work: installing and updating packages, managing filesystems and mount points, tracking down runaway processes, scheduling jobs with cron and systemd timers, reading logs. It ships with ready commands for Debian/Ubuntu (apt) and RHEL/CentOS/Fedora (dnf), plus examples for lsblk, fstab, journalctl, logrotate and network tools.

You need root or sudo on the target machine and SSH access already set up. The package manager has to be there too: apt on Debian/Ubuntu, dnf on RHEL 8+ and Fedora. Without sudo the skill has nothing to work with — the commands simply won't run.

It assumes you're comfortable in a terminal, so basic familiarity with vim or nano helps. Some examples target specific package versions and distributions, so check the commands against your own system before running them.

What it helps with

  • update packages and clear out unused dependencies
  • find which process grabbed a port or ate the memory
  • attach a new disk and make it persistent in fstab
  • set up log rotation for a custom application
  • trace an error in journalctl over a given time range

Example prompts for the agent

  • Show me which processes are listening on port 80 and who started them
  • Set up a daily backup at 2:30 via cron
  • Check inode usage on this server — the disk looks free but writes are failing

How to install linux-administration

1Skills CLI (Vercel)

npx skills add BagelHole/DevOps-Security-Agent-Skills --skill linux-administration -a claude-code

2Manually: put the files in place

~/.claude/skills/linux-administration/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/linux-administration/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about linux-administration

How do I install linux-administration in Claude?

Run npx skills add BagelHole/DevOps-Security-Agent-Skills --skill linux-administration -a claude-code. The skill file then lands at ~/.claude/skills/linux-administration/SKILL.md.

What does linux-administration do?

It gives the agent a set of Linux admin commands: package, service, filesystem, process, cron and log management across Debian/Ubuntu and RHEL/CentOS.

What do I need for the skill to work?

Root or sudo on the target system, SSH access configured, and a matching package manager — apt or dnf. Basic terminal editor skills with vim or nano help too.

Source text

SKILL.md · MIT
---
name: linux-administration
description: System administration for Linux servers. Manage packages, services, and system configuration. Use when administering Linux systems.
license: MIT
metadata:
  author: devops-skills
  version: "1.0"
---

# Linux Administration

Core Linux system administration skills for managing production servers, development environments, and infrastructure hosts across Debian/Ubuntu and RHEL/CentOS distributions.

## When to Use

- Provisioning and maintaining Linux servers in any environment
- Installing, updating, or removing software packages
- Managing filesystems, disk usage, and mount points
- Investigating runaway processes or high resource consumption
- Scheduling recurring tasks with cron or systemd timers
- Analyzing system and application logs for troubleshooting

## Prerequisites

- Root or sudo access on the target system
- SSH access configured (see `ssh-configuration` skill)
- Familiarity with a terminal text editor (vim, nano)
- Package manager available (`apt` on Debian/Ubuntu, `dnf` on RHEL 8+/Fedora)

## Package Management

### Debian / Ubuntu (apt)

```bash
# Update package index and upgrade all installed packages
apt update && apt upgrade -y

# Search for a package by keyword
apt search nginx

# Show detailed package info including dependencies
apt show nginx

# Install a specific version of a package
apt install nginx=1.24.0-1ubuntu1

# Install multiple packages in one command
apt install -y nginx certbot python3-certbot-nginx

# Remove a package but keep its config files
apt remove nginx

# Remove a package and purge all config files
apt purge nginx

# Remove unused dependency packages
apt autoremove -y

# List all installed packages
dpkg -l | grep nginx

# Pin a package to prevent automatic upgrades
cat <<'EOF' > /etc/apt/preferences.d/pin-nginx
Package: nginx
Pin: version 1.24.0-1ubuntu1
Pin-Priority: 1001
EOF

# Add an external repository (example: Docker CE)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
  > /etc/apt/sources.list.d/docker.list
apt update
```

### RHEL / CentOS / Fedora (dnf)

```bash
# Update all packages
dnf update -y

# Search for a package
dnf search nginx

# Show package details
dnf info nginx

# Install a package
dnf install -y nginx

# Install a specific version
dnf install nginx-1.24.0-1.el9

# Remove a package
dnf remove nginx

# List installed packages
dnf list installed | grep nginx

# Enable a module stream (example: Node.js 20)
dnf module enable nodejs:20
dnf install -y nodejs

# Add an external repository
dnf install -y epel-release

# View repository list
dnf repolist --all

# Clean cached package data
dnf clean all
```

## System Information

```bash
# Kernel and OS release
uname -a
cat /etc/os-release

# Hostname and system metadata
hostnamectl

# CPU information
lscpu
nproc                      # Number of processing units

# Memory usage (human-readable)
free -h

# Disk usage summary
df -hT                     # Include filesystem type
du -sh /var/log/*          # Summarize directory sizes

# Network interfaces and IP addresses
ip addr show
ip route show              # Routing table

# Uptime and load average
uptime
w                          # Who is logged in and load
```

## Filesystem Management

```bash
# List block devices and partitions
lsblk
fdisk -l

# Create a new ext4 filesystem on a partition
mkfs.ext4 /dev/sdb1

# Mount a filesystem temporarily
mount /dev/sdb1 /mnt/data

# Add a persistent mount via fstab
echo '/dev/sdb1  /mnt/data  ext4  defaults,noatime  0  2' >> /etc/fstab
mount -a                   # Mount everything in fstab

# Check and repair a filesystem (unmount first)
umount /dev/sdb1
fsck.ext4 -y /dev/sdb1

# Monitor disk I/O in real time
iostat -xz 2

# Find files larger than 100 MB
find / -xdev -type f -size +100M -exec ls -lh {} \;

# Check inode usage (out-of-inodes can mimic out-of-disk)
df -i
```

## Process Management

```bash
# List all processes with full details
ps auxf

# Interactive process viewer (prefer htop if installed)
top
htop

# Find processes by name
pgrep -la nginx

# Show process tree
pstree -p

# Send graceful stop signal (SIGTERM)
kill <pid>

# Force kill an unresponsive process (SIGKILL)
kill -9 <pid>

# Kill all processes matching a name
pkill nginx

# Show open files for a process
lsof -p <pid>

# Show which process is listening on a port
ss -tlnp | grep :80
lsof -i :80

# Run a process immune to hangups (persists after logout)
nohup /opt/myapp/start.sh > /var/log/myapp.log 2>&1 &

# Limit CPU usage of a running process with cgroups v2
systemd-run --scope -p CPUQuota=25% --unit=limit-myapp /opt/myapp/start.sh
```

## Cron Job Management

```bash
# Edit the current user's crontab
crontab -e

# List current user's cron jobs
crontab -l

# Example crontab entries
# ┌───── minute (0-59)
# │ ┌───── hour (0-23)
# │ │ ┌───── day of month (1-31)
# │ │ │ ┌───── month (1-12)
# │ │ │ │ ┌───── day of week (0-7, 0 and 7 = Sunday)
# * * * * * command

# Run a backup every day at 2:30 AM
30 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

# Run a cleanup every Sunday at midnight
0 0 * * 0 /usr/local/bin/cleanup.sh

# Run a health check every 5 minutes
*/5 * * * * /usr/local/bin/healthcheck.sh

# Place system-wide cron scripts in drop-in directories
ls /etc/cron.daily/
ls /etc/cron.weekly/

# Restrict cron access to specific users
echo "deploy" >> /etc/cron.allow
```

## Log Management

```bash
# Follow systemd journal for a specific service
journalctl -u nginx -f

# Show logs since last boot
journalctl -b

# Show logs from a specific time range
journalctl --since "2025-01-15 08:00" --until "2025-01-15 12:00"

# Show only error-level and above
journalctl -p err

# Tail traditional syslog
tail -f /var/log/syslog          # Debian/Ubuntu
tail -f /var/log/messages        # RHEL/CentOS

# Kernel ring buffer messages
dmesg -T                          # Human-readable timestamps
dmesg --level=err,warn

# Check disk usage of log directory
du -sh /var/log/*

# Configure logrotate for a custom application
cat <<'EOF' > /etc/logrotate.d/myapp
/var/log/myapp/*.log {
    daily
    missingok
    rotate 14
    compress
    delaycompress
    notifempty
    create 0640 myapp myapp
    sharedscripts
    postrotate
        systemctl reload myapp > /dev/null 2>&1 || true
    endscript
}
EOF

# Force a logrotate run for testing
logrotate -f /etc/logrotate.d/myapp

# Centralized logging: forward journal to a remote syslog
# In /etc/systemd/journal-upload.conf:
# URL=http://logserver.example.com:19532
```

## Networking Essentials

```bash
# Test connectivity
ping -c 4 8.8.8.8

# DNS lookup
dig example.com
nslookup example.com

# Trace route to host
traceroute example.com

# List listening ports and associated processes
ss -tlnp

# Show active connections
ss -tunap

# Firewall management (UFW on Ubuntu)
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
ufw status verbose

# Firewall management (firewalld on RHEL/CentOS)
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
firewall-cmd --list-all
```

## Troubleshooting

| Symptom | Diagnostic Command | Common Fix |
|---|---|---|
| Disk full | `df -h` and `du -sh /var/log/*` | Clear old logs, run `logrotate -f`, remove temp files |
| Out of inodes | `df -i` | Delete many small files, check `/tmp` and mail spools |
| High CPU usage | `top`, `ps aux --sort=-%cpu` | Identify and restart or kill the offending process |
| High memory / swapping | `free -h`, `vmstat 1` | Tune `vm.swappiness`, add RAM, identify memory leak |
| Service won't start | `systemctl status <svc>`, `journalctl -u <svc>` | Check config syntax, file permissions, port conflicts |
| DNS resolution fails | `dig @8.8.8.8 example.com`, `cat /etc/resolv.conf` | Fix nameserver entries, restart `systemd-resolved` |
| Package dependency error | `apt --fix-broken install` or `dnf distro-sync` | Resolve held or conflicting packages |
| SSH connection refused | `ss -tlnp \| grep 22`, `systemctl status sshd` | Ensure sshd is running and firewall allows port 22 |

## Related Skills

- `ssh-configuration` -- Secure remote access to Linux servers
- `user-management` -- Create and manage users, groups, and sudo
- `systemd-services` -- Write and manage systemd unit files
- `performance-tuning` -- Kernel and application performance optimization
- `backup-recovery` -- Protect server data with automated backups

© devops-skills · MIT · BagelHole/DevOps-Security-Agent-Skills

Similar skills

All skills for DevOps and infrastructure →

From the same set129

linux-hardening A skill that walks your agent through CIS benchmarks: SSH config, user policy, firewall rules and kernel parameters. Useful when a server heads to production or an audit. CX Codex +1 769installs docker-compose Teaches the agent to write docker-compose.yml and reason about services, networks and volumes. Useful when your local setup spans several containers. CX Codex +1 550installs docker-management Instructions for building multi-stage Dockerfiles, managing container networks, and troubleshooting failed processes. Useful for container deployment and debugging. CX Codex +1 508installs systemd-services Creates and manages systemd service units, timers, and socket activation. Use it to run background apps and configure resource limits under Linux. CX Codex +1 504installs reverse-proxy Configures nginx and Traefik as reverse proxies for TLS termination, path routing, and rate limiting. CX Codex +1 473installs firewall-config A skill that writes and reviews firewall rules: iptables, nftables, UFW and AWS security groups. Useful when you lock down a server perimeter or split a network into zones. CX Codex +1 458installs ssh-configuration Configures OpenSSH clients and servers, handles Ed25519 keys, port forwarding, and bastion jumps for secure Linux server access. CX Codex +1 451installs prometheus-grafana This skill gives your agent templates for Prometheus scraping, PromQL queries and Grafana panels. Handy when a project needs monitoring added. CX Codex +1 449installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor