Loading...
Loading...
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.
npx skill4agent add ancoleman/ai-design-components administering-linuxnetwork-architecturesecurity-hardeningconfiguration-managementkubernetes-operationssystemctl 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 logstop # 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)df -h # Filesystem usage
du -sh /path/to/dir # Directory size
ncdu /path # Interactive disk analyzerjournalctl -f # Follow all logs
journalctl -u service -f # Follow service logs
journalctl --since "1 hour ago" # Filter by time
journalctl -p err # Show errors onlyuseradd -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/etc/systemd/system//run/systemd/system//lib/systemd/system/.service.timer.target.socketsystemctl 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 filereferences/systemd-guide.mdnice -n 10 command # Start with lower priority
renice -n 5 -p PID # Change priority of running process//etc//var//opt//usr//home//tmp//boot/references/filesystem-management.mdapt update && apt upgrade # Update system
apt install package # Install package
apt remove package # Remove package
apt search keyword # Search packagesdnf update # Update all packages
dnf install package # Install package
dnf remove package # Remove package
dnf search keyword # Search packagestop # Quick overview
uptime # Load averagestop # Press Shift+P to sort by CPU
ps aux --sort=-%cpu | headfree -h # Memory usage
top # Press Shift+M to sort by memoryiostat -x 1 # Disk statistics
iotop # I/O by processss -tunap # Active connections
iftop # Bandwidth monitorreferences/troubleshooting-guide.mdsudo nano /etc/systemd/system/myapp.service[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.targetsudo 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.serviceexamples/systemd-units/OnCalendar=Persistent=trueType=oneshotexamples/systemd-units/backup.timerbackup.servicessh-keygen -t ed25519 -C "admin@example.com"
ssh-copy-id admin@serversudo nano /etc/ssh/sshd_configPermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
AllowUsers admin deploy
X11Forwarding no
Port 2222 # Optionalsudo sshd -t # Test
sudo systemctl restart sshd # Apply (keep backup session!)examples/configs/sshd_config.hardenedreferences/security-hardening.md/etc/sysctl.d/99-custom.conf/etc/security/limits.confreferences/performance-tuning.mdexamples/configs/systemctl status myappjournalctl -u myapp--since-p errgreptopdf -hfree -hjournalctl -k | grep -i oomreferences/troubleshooting-guide.mdip addr show # Show all interfaces
ip link set eth0 up # Bring interface up
ip addr add 192.168.1.100/24 dev eth0ip route show # Show routing table
ip route get 8.8.8.8 # Show route to IP
ip route add 10.0.0.0/24 via 192.168.1.1ss -tunap # All TCP/UDP connections
ss -tlnp # Listening TCP ports
ss -ulnp # Listening UDP ports
ss -tnp state established # Established connectionssudo ufw status
sudo ufw enable
sudo ufw allow 22/tcp # Allow SSH
sudo ufw allow 80/tcp # Allow HTTP
sudo ufw allow from 192.168.1.0/24 # Allow from subnet
sudo ufw default deny incomingfirewall-cmd --state
firewall-cmd --list-all
firewall-cmd --add-service=http --permanent
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --reloadreferences/network-configuration.mdcrontab -e # Edit user crontab
# Format: minute hour day month weekday command
0 2 * * * /usr/local/bin/backup.sh # Daily at 2:00 AM
*/5 * * * * /usr/local/bin/check-health.sh # Every 5 minutes
0 3 * * 0 /usr/local/bin/weekly-cleanup.sh # Weekly Sunday 3 AM
@reboot /usr/local/bin/startup-script.sh # Run at bootOnCalendar=daily # Every day at midnight
OnCalendar=*-*-* 02:00:00 # Daily at 2:00 AM
OnCalendar=Mon *-*-* 09:00:00 # Every Monday at 9 AM
OnCalendar=*-*-01 00:00:00 # 1st of every month
OnBootSec=5min # 5 minutes after boottophtoppspgrep/pkilljournalctlgreptail -fdfdulsblkncduipsspingdig/nslookuptcpdump# /etc/sysctl.d/99-kubernetes.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1kubernetes-operationsconfiguration-managementsecurity-hardeningbuilding-ci-pipelinesreferences/systemd-guide.mdreferences/performance-tuning.mdreferences/filesystem-management.mdreferences/network-configuration.mdreferences/security-hardening.mdreferences/troubleshooting-guide.mdexamples/systemd-units/examples/scripts/examples/configs/aptnetplanufw/etc/apt/sources.listdnfNetworkManagerfirewalld/etc/yum.repos.d/pacmanNetworkManagerkubernetes-operationsconfiguration-managementsecurity-hardeningbuilding-ci-pipelinesperformance-engineering