Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2025-12-14 - [Bash Script UX]
**Learning:** CLI tools in this repo are heavily macOS-dependent but lack compatibility checks, leading to confusing errors on other systems.
**Action:** When working on shell scripts, always add `command -v` checks or OS detection to provide clear feedback instead of raw errors.

## 2025-12-15 - [CLI Header Retention]
**Learning:** Standard `sort` commands in pipelines often swallow or displace CSV/Table headers, making output unreadable.
**Action:** Use `awk 'NR==1 {print; next} {print | "sort ..."}'` pattern to reliably preserve headers in sorted CLI output.
13 changes: 9 additions & 4 deletions ops/monitoring/top-hogs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

set -e

echo "[top-hogs] Top 10 CPU-consuming processes:"
ps aux | sort -nrk 3 | head -n 11
# ANSI Color Codes
BLUE='\033[0;34m'
BOLD='\033[1m'
RESET='\033[0m'

echo "\n[top-hogs] Top 10 Memory-consuming processes:"
ps aux | sort -nrk 4 | head -n 11
echo -e "${BLUE}${BOLD}[top-hogs] Top 10 CPU-consuming processes:${RESET}"
ps aux | awk 'NR==1 {print; next} {print | "sort -nrk 3 | head -n 10"}'

echo -e "\n${BLUE}${BOLD}[top-hogs] Top 10 Memory-consuming processes:${RESET}"
ps aux | awk 'NR==1 {print; next} {print | "sort -nrk 4 | head -n 10"}'
Loading