EDGE CLUSTERS: yt-dl.unixcorn.org (Media Suite) tor.unixcorn.org (Privacy Archive) cloud.unixcorn.org (Homelab Hub) paste.unixcorn.org (Encrypted Paste) unixcorn.org (DevOps Tools)
CURATED RECIPES

Linux & DevOps Battle-Tested Bash Recipes

Production-ready one-liners for troubleshooting high load, parsing access logs, inspecting memory leaks, and container diagnostics.

30 Recipes Available
SYSTEM

Top 10 CPU Consuming Processes

Displays the top 10 running processes consuming the most CPU cycles, including PID and memory utilization.

$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head -n 11
MEMORY

Top 10 Memory Consuming Processes

Sorts all system processes in descending order of physical RAM usage.

$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 11
SYSTEM

Live System Bottleneck Overview

Reports virtual memory statistics, CPU user/system/idle/wa (I/O wait) ticks every second for 5 iterations.

$ vmstat 1 5 -w
MEMORY

Inspect Out-Of-Memory (OOM) Killer Logs

Scans the kernel ring buffer with human timestamps to check if Linux invoked the OOM killer on rogue processes.

$ dmesg -T | grep -i -E 'oom[- ]killer|killed process'
MEMORY

Clear Linux PageCache, Dentries and Inodes

Flushes dirty pages to disk and safely drops unneeded cached memory from kernel RAM.

$ sync && echo 3 > /proc/sys/vm/drop_caches
DISK

Find Top 20 Largest Files on Filesystem

Searches the root partition without crossing filesystem boundaries for individual files larger than 100MB.

$ find / -xdev -type f -size +100M -exec ls -lh {} + 2>/dev/null | sort -k5 -rh | head -n 20
DISK

Interactive Disk Space Analyzer

Launches an interactive ncurses directory size browser confined to the primary root filesystem.

$ ncdu -x /
DISK

Vacuum Systemd Journal Logs Over 500MB

Safely prunes persistent systemd journal logs keeping only the last 14 days or maximum 500MB.

$ journalctl --vacuum-size=500M --vacuum-time=14d
DISK

Find Deleted Files Still Held Open in RAM

Identifies deleted log files that are still holding disk space because active processes keep their file handles open.

$ lsof -nP +L1 | grep '(deleted)'
NETWORKING

List All Listening TCP and UDP Ports with Process Names

Displays all active listening sockets, binding IP addresses, ports, and associated process names/PIDs.

$ ss -tulpn
NETWORKING

Identify What Process is Listening on a Specific Port

Instantly looks up the process name, user, and PID binding TCP port 8080.

$ lsof -i :8080 -sTCP:LISTEN
PROCESS

Kill Whatever Process is Holding a Port Open

Sends SIGKILL to any local process binding port 8080 so a crashed daemon can restart.

$ fuser -k 8080/tcp
NETWORKING

Test Remote TCP Socket Connection with Netcat

Probes an IP and port for TLS/TCP handshake availability with a 3-second timeout.

$ nc -zv -w 3 192.168.1.50 443
NETWORKING

Check HTTP Response Headers and TLS Handshake Latency

Performs verbose HTTP/2 / HTTP/3 header negotiation and SSL certificate validation.

$ curl -Iv --compressed https://unixcorn.org
NETWORKING

Trace Complete DNS Resolution Hierarchy

Follows the recursive DNS delegation starting from root nameservers down to authoritative nameservers.

$ dig +trace +nodnssec unixcorn.org
NETWORKING

Live Capture HTTP/HTTPS Traffic on eth0

Sniffs and displays 50 live packets traversing web ports without resolving hostnames.

$ tcpdump -nn -i eth0 'port 80 or port 443' -c 50
LOGS

Extract Top 10 Requesting Client IPs from Nginx Log

Parses standard web access logs and prints the top 10 IP addresses by hit frequency.

$ awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head -n 10
LOGS

Count HTTP Response Status Codes in Access Log

Groups and counts HTTP return codes (200, 301, 404, 500, 502) to detect application anomalies.

$ awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -nr
LOGS

Real-Time Tail Log Highlighting Errors in Red

Follows syslog stream with colored highlights on warning and error strings.

$ tail -f /var/log/syslog | grep --line-buffered -E --color=always 'error|warn|fail|fatal|$'
SECURITY

Inspect SSL Certificate Expiration and Subject Info

Reads an X.509 certificate and prints the expiration timestamp and Common Name (CN).

$ openssl x509 -in /etc/ssl/certs/cert.pem -noout -text | grep -E 'Not After|Subject:'
SECURITY

Verify Remote Server TLS Certificate Expiration Date

Establishes a live TLS handshake with SNI and returns valid-from and valid-to certificate dates.

$ echo | openssl s_client -servername unixcorn.org -connect unixcorn.org:443 2>/dev/null | openssl x509 -noout -dates
SECURITY

Generate High-Entropy 32-Character Random Password

Generates a cryptographically strong, clean password using OpenSSL random entropy.

$ openssl rand -base64 24 | tr -dc 'a-zA-Z0-9!@#%' | head -c 32; echo
DOCKER

Docker Container Real-Time CPU and Memory Monitor

Streams real-time container resource consumption in an organized terminal table.

$ docker stats --format 'table {{.Name}} {{.CPUPerc}} {{.MemUsage}} {{.NetIO}} {{.BlockIO}}'
DOCKER

Find IP Address of Running Docker Container

Inspects container network namespace and returns the assigned internal bridge IP.

$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name
DOCKER

Purge All Dangling Docker Images, Containers and Volumes

Reclaims disk space by purging stopped containers, unused networks, and dangling volumes.

$ docker system prune -af --volumes
PROCESS

Kill Defunct / Zombie Processes

Finds zombie processes and signals their parent PIDs to clean up lingering process table entries.

$ ps -ef | grep defunct | grep -v grep | awk '{print $3}' | xargs -r kill -9
SYSTEM

Compare Two Directories Recursively for Differences

Recursively reports files that are present in only one directory or differ in content.

$ diff -rq /etc/nginx/ /etc/nginx.bak/
DISK

Check Disk I/O Read/Write Speed via Direct I/O

Bypasses operating system buffer cache to measure raw sequential NVMe/SSD write throughput.

$ dd if=/dev/zero of=./testfile bs=1G count=1 oflag=direct status=progress && rm -f ./testfile
SYSTEM

Find Files Modified Within the Last 60 Minutes

Rapidly detects freshly uploaded or altered files across a web tree.

$ find /var/www -type f -mmin -60
LOGS

Convert JSON File to Formatted Table via jq

Transforms an array of JSON objects into an aligned human-readable terminal table.

$ cat data.json | jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @tsv' | column -t