BELAJARLINUX // CONTEKAN SIAP CETAK & PDF

Cheatsheet Perintah Linux (Roadmap L0–L18)

Ringkasan padat dari 0 hingga Homelab & Alpine Diskless. Klik Cetak / Simpan PDF lalu pilih Save as PDF (A4) untuk ditempel di meja atau dibaca offline.

Fondasi & Navigasi

L0 – L1
  • uname -a && cat /etc/os-releaseCek versi kernel, CPU, dan identitas distro Linux.
  • id && whoamiCek user aktif, UID, GID, dan daftar grup.
  • pwd && ls -lahTampilkan folder aktif & seluruh file (termasuk hidden).
  • cd -Lompat cepat balik ke folder sebelumnya.
  • find /etc -type f -name "*.conf"Cari seluruh file konfigurasi .conf di /etc.

File, Arsip & Izin

L2 – L3
  • mkdir -p /tmp/a/b && touch /tmp/a/b/cBuat direktori bersarang & file kosong sekaligus.
  • ln -sfn /target/asli /path/linkBuat atau perbarui symlink secara aman.
  • tar -czvf bak.tar.gz dir/Kompres folder .tar.gz (ekstrak: tar -xzvf).
  • chown -R nginx:nginx /mnt/data/wwwUbah pemilik & grup folder secara rekursif.
  • chmod 750 dir && chmod 1777 /tmpIzin rwxr-x--- (aman) & Sticky Bit untuk folder publik.

Teks, Pipe & Metrik

L4 – L5
  • grep -rn "error" /var/log/Cari teks secara rekursif beserta nomor baris.
  • perintah | tee hasil.logTampilkan output di layar sekaligus simpan ke log.
  • free -hCek RAM terpakai, available (akurat), dan Swap/ZRAM.
  • uptime && nprocBandingkan Load Average 1/5/15m dengan jumlah core CPU.
  • du -xhd1 /var | sort -hr | headCari sub-folder paling boros ruang disk.

Proses, Service & Paket

L6 – L8
  • ps aux | grep nginxLihat PID, konsumsi CPU/RAM, dan argumen proses.
  • kill -15 PIDHentikan proses halus (SIGTERM); reload: kill -HUP.
  • nice -n 10 cmdJalankan tugas berat dengan prioritas CPU rendah.
  • rc-status -aCek status layanan OpenRC (systemd: systemctl).
  • apk add --no-cache htopPasang paket hemat ruang di Alpine tanpa cache indeks.

Storage, Kernel & Swap

L9 – L10
  • lsblk -f && df -hT && df -iLihat struktur disk, UUID, ruang kosong, dan sisa Inode.
  • mount -aUji validitas semua baris /etc/fstab sebelum reboot.
  • dmesg -T | grep -iE "err|oom"Audit pesan error hardware, disk, atau OOM Killer.
  • cat /proc/swapsCek prioritas ZRAM vs swapfile aktif.
  • sysctl vm.swappinessPeriksa parameter tuning kernel secara langsung.

Jaringan, SSH & Firewall

L11 – L12
  • ip -br addr && ip route showRingkasan IP tiap interface & tabel routing gateway.
  • dig @1.1.1.1 domain.com +shortUji resolusi DNS langsung ke resolver tertentu.
  • ssh-keygen -t ed25519Buat pasangan kunci SSH modern, cepat, dan aman.
  • sshd -tWajib uji sintaks sshd_config sebelum reload SSH.
  • nft -c -f /etc/nftables.nft && nft list rulesetUji sintaks dan lihat aturan firewall nftables.

Shell, Cron & Net Debug

L13 – L14
  • sh -n skrip.sh && bash -x skrip.shCek sintaks tanpa eksekusi (-n) & mode debug (-x).
  • set -euo pipefailMode ketat agar skrip langsung berhenti saat error.
  • crontab -lLihat jadwal tugas otomatis (cron job) user aktif.
  • ss -tulnpCek semua port TCP/UDP yang LISTEN beserta nama proses.
  • curl -I https://url && mtr -r -c 10 1.1.1.1Cek header HTTP & latensi/packet-loss per hop.

Homelab, VPN & Alpine Diskless

L15 – L18
  • nginx -t && rc-service nginx reloadUji sintaks & reload Nginx tanpa memutus pengunjung.
  • docker compose up -d && docker compose psJalankan stack container di background & cek status.
  • tailscale status && wg showPantau node mesh VPN Tailscale / interface WireGuard.
  • rsync -avzP --delete src/ dst/Sinkronisasi backup inkremental hemat bandwidth.
  • lbu status && lbu diff && lbu commit -dAudit perubahan /etc & simpan permanen ke .apkovl.

Perbandingan Cepat: Debian/Ubuntu (systemd) vs Alpine Linux (OpenRC)

Tugas Debian / Ubuntu (systemd) Alpine Linux (OpenRC)
Pasang paket apt update && apt install -y pkg apk add --no-cache pkg
Cek semua service systemctl list-units --type=service rc-status -a
Reload service systemctl reload nginx rc-service nginx reload
Aktifkan saat boot systemctl enable --now app rc-update add app default
Simpan config Diskless Langsung tersimpan di disk lbu commit -d