Skill 详情
linux-administration
Relevant operations specialization, but focused on Linux system administration.
使用前先检查
自动化审核只检查相关性,不代表安全审查或推荐。使用前请阅读来源中的说明。
SKILL.md
这段内容是审核时保存的快照。外部来源才是完整且最新的版本。
--- 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 / -xd在 GitHub 阅读完整来源 (打开外部页面)