Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› οΈ Utility Scripts

A curated, cross-platform collection of battle-tested command-line utilities for system maintenance, security scanning, and productivity β€” on macOS (Bash) and Windows (PowerShell/Batch).

Bash PowerShell Platform License Scripts

Overview

This repository (~/.bin) contains practical command-line tools for everyday system maintenance and WordPress security work. Each utility is self-contained, safe by default, and targets the platform(s) it was built for β€” some are macOS-only, some are Windows-only, and some ship a version for both.

Available Utilities

Utility Platform Purpose
🧹 Disk Cleanup macOS + Windows Interactive cache/temp-file cleaner
πŸ›‘ Google Drive Killer macOS Force-quits stuck Google Drive processes
🌐 My IP Windows Lists local IPv4 addresses per network interface
πŸ”§ WP-CLI Wrapper macOS/Linux + Windows Portable wp-cli.phar launcher
πŸ›‘οΈ WP Security Scanner Cross-platform (PowerShell) Scans WordPress PHP/JS files for malware patterns

Comprehensive, interactive disk space cleaner that safely removes caches and temporary files. Ships two implementations sharing the same feature set:

  • cleanup-disk (Bash) β€” macOS: Xcode DerivedData, browser caches, package manager caches, Homebrew, iOS simulators, Claude Code scratchpads, and more
  • cleanup-disk.ps1 (PowerShell 7+) β€” Windows: same categories adapted for Windows, plus multi-drive selection (-Drive C,D, -Drive All)

Quick Start:

# macOS
cleanup-disk --dry-run   # Preview cleanup
cleanup-disk --common    # Clean typical items
# Windows (pwsh)
.\cleanup-disk.ps1 -DryRun
.\cleanup-disk.ps1 -Common -Drive C

πŸ“š Full Documentation


Gracefully terminates Google Drive and all related processes on macOS.

Key Features:

  • Graceful shutdown with AppleScript, falling back to SIGTERM β†’ SIGKILL
  • Terminates all helper processes, crashpad handlers, and Finder extensions
  • Process verification and reporting

Quick Start:

killgd             # Stop Google Drive
killgd && sleep 2 && open -a "Google Drive"  # Restart

πŸ“š Full Documentation


🌐 My IP

One-liner PowerShell script that lists every active IPv4 address on the machine, alongside its interface name (loopback excluded).

Quick Start:

.\myip\myip.ps1

Portable WP-CLI launcher bundling wp-cli.phar, so wp works from any shell without a separate install:

  • wp β€” Bash wrapper (macOS/Linux, Cygwin-aware path translation)
  • wp.bat β€” Windows Batch wrapper

Quick Start:

wp --info
wp.bat --info

Requires PHP on the PATH.


πŸ›‘οΈ WP Security Scanner

PowerShell script that recursively scans WordPress PHP/JS files for common malware and obfuscation patterns (eval, base64_decode chains, unsanitized $_REQUEST usage passed to exec/system, suspicious atob/fromCharCode in JS, etc.), and can export findings to a Markdown report.

Quick Start:

.\wp-scan\wp-scan.ps1 -Path C:\path\to\wordpress

πŸ“¦ Installation

macOS

# Clone the repository
git clone https://github.com/LPdsgn/macos-scripts.git ~/.bin

# Make Bash scripts executable
chmod +x ~/.bin/cleanup/cleanup-disk ~/.bin/killgd/kill-google-drive

# Add to PATH (~/.zshrc or ~/.bashrc)
export PATH="$HOME/.bin/cleanup:$HOME/.bin/killgd:$HOME/.bin/wp:$PATH"

Windows

# Clone the repository
git clone https://github.com/LPdsgn/macos-scripts.git $HOME\.bin

# Allow running local scripts (once, per user)
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

# Add to PATH (persist via $PROFILE or System Environment Variables)
$env:PATH += ";$HOME\.bin\cleanup;$HOME\.bin\myip;$HOME\.bin\wp-scan;$HOME\.bin\wp"

PowerShell scripts require PowerShell 7+ (pwsh, not the legacy powershell.exe).

Use Cases

For Developers

  • Clean up Xcode DerivedData, iOS simulators, and Claude Code scratchpads (macOS)
  • Remove Node.js, pip, Cargo, Maven/Gradle package manager caches (macOS + Windows)
  • Manage WordPress installs from the CLI without a global WP-CLI install

For Power Users

  • Clean browser caches across all major browsers
  • Reclaim space across multiple drives on Windows
  • Check local network IPv4 addresses at a glance

For WordPress Maintainers

  • Scan themes and plugins for backdoors, obfuscated code, and suspicious patterns before/after an incident
  • Export scan results to a shareable Markdown report

For System Maintenance

  • Restart an unresponsive Google Drive client
  • Free up space before major OS updates
  • Regular maintenance automation via scheduled tasks / cron

πŸ“‹ Requirements

Tool Requirement
cleanup-disk (Bash) macOS, Bash 4.0+
cleanup-disk.ps1 Windows, PowerShell 7.0+
kill-google-drive macOS, Google Drive for desktop installed
myip.ps1 Windows, PowerShell 7.0+
wp / wp.bat PHP on PATH
wp-scan.ps1 PowerShell 7.0+ (any OS)

All scripts run at user-level permissions β€” no sudo/admin required.

πŸ”’ Safety & Security

All scripts follow these principles:

  • βœ… Safe by Default: Cleanup scripts remove only regenerable caches and temporary files
  • βœ… User Confirmation: Interactive prompts before destructive operations
  • βœ… Dry Run Mode: Preview changes without executing them (--dry-run / -DryRun)
  • βœ… Graceful Handling: Try gentle methods before forceful ones
  • βœ… Clear Reporting: Detailed output with success/failure statistics
  • βœ… Read-Only Scanning: wp-scan only reads files and flags patterns β€” it never modifies or deletes anything
  • βœ… No Sudo/Admin: All operations run with user-level permissions

🀝 Contributing

Contributions are welcome! Here's how you can help:

Adding New Utilities

  1. Create a new directory for your script
  2. Follow the established pattern:
    • Bash and/or PowerShell script with clear comments
    • Safety features (dry-run, confirmations) where destructive
    • A per-tool README.md
    • Error handling and reporting
  3. Test on the platform(s) you target
  4. Submit a pull request

Coding Standards

  • Bash: set -euo pipefail for robust error handling
  • PowerShell: #Requires -Version 7.0, typed param() blocks
  • Implement dry-run mode for destructive operations
  • Provide colored, user-friendly output
  • Include help text (--help / -Help)

License

MIT License - Feel free to use, modify, and distribute these scripts.


Last updated: August 2026

About

A curated, cross-platform collection of battle-tested command-line utilities for system maintenance, security scanning, and productivity.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages