#!/bin/sh # Honesty Speed for Linux. Clears user and browser caches and flushes the system DNS cache when allowed. # Documents, photos, and saved passwords stay. set -u echo "Honesty Speed" echo "Cleaning caches. Documents, photos, and passwords stay." before=$(df -k "$HOME" | awk 'NR==2 {print $4}') clean_dir() { label="$1" path="$2" if [ ! -d "$path" ]; then echo "$label: nothing to clean" return fi bytes=$(du -sk "$path" 2>/dev/null | awk '{print $1}') find "$path" -mindepth 1 -maxdepth 1 -exec rm -rf {} + 2>/dev/null || true echo "$label: cleared (about ${bytes:-0} KB was in that folder)" } clean_dir "Chrome cache" "$HOME/.cache/google-chrome" clean_dir "Chromium cache" "$HOME/.cache/chromium" clean_dir "Firefox cache" "$HOME/.cache/mozilla" clean_dir "Thumbnail cache" "$HOME/.cache/thumbnails" if command -v resolvectl >/dev/null 2>&1; then resolvectl flush-caches 2>/dev/null && echo "DNS: flushed" || echo "DNS: could not flush (try with sudo)" elif command -v systemd-resolve >/dev/null 2>&1; then systemd-resolve --flush-caches 2>/dev/null && echo "DNS: flushed" || echo "DNS: could not flush (try with sudo)" else echo "DNS: no resolver cache command on this computer" fi after=$(df -k "$HOME" | awk 'NR==2 {print $4}') freed=$((after - before)) if [ "$freed" -lt 0 ]; then freed=0; fi echo "About $((freed / 1024)) MB more free." echo "Still slow? Call 1-888-711-9954 or open https://honestysupport.com/it"