A collection of useful command-line tools written in Go, designed to enhance your development workflow and file management tasks.
Analyze folder sizes with colored output, progress tracking, and customizable exclusions. Perfect for identifying disk space usage.
Search for text content within files using regex or plain text matching. Supports multiple file types and directory exclusions.
Advanced file and directory finder with pattern matching, size filtering, and parallel processing for large directory trees.
Find and replace UTF-8 text in files or directories with optional backups, dry-run analysis, and bounded-memory streaming.
HTTP load and stress testing tool for APIs with performance metrics collection.
- Go 1.24 or later
- Git (for cloning)
- Powershell 7 - required only if you run these tools in Windows PowerShell. Ignore if you're using Command Prompt.
-
Clone the repository:
git clone <repository-url> cd my-cli
-
Build and install all tools:
make all
-
Or build individual tools:
make check-folder-size make find-content make find-everything make replace-text make api-stress-test
The Makefile supports both Linux and Windows (PowerShell 7 with MSYS2
make).
Purpose: Analyze disk usage and identify large files/folders.
Key Features:
- Colored output based on size (green/yellow/red)
- Progress tracking for large directories
- Customizable exclusions
- Sort by size or name
- Native allocated disk usage on macOS, Linux, and Windows; logical size remains available
- Deterministic hardlink accounting, valid JSON output, and explicit partial-scan failures
Usage:
# Analyze current directory
./check-folder-size
# Analyze with progress
./check-folder-size -progress
# Exclude specific folders
./check-folder-size -exclude-dirs "node_modules,.git"
# Sort by name
./check-folder-size -sort name -asc
# Report apparent/logical bytes instead of allocated disk usage
./check-folder-size --size-mode logical
# Produce machine-readable output without progress or ANSI contamination
./check-folder-size --json--size-mode allocated is the default. It uses native allocated bytes and includes
the metadata blocks of displayed directories and their descendants; the scan
root's own blocks are excluded so the reported total equals the sum of displayed
items. --size-mode logical reports apparent file bytes and preserves the
logical-size use case. Displayed units and B/KB/MB/GB/TB filters use
binary multipliers (base 1024).
Hidden names are scanned normally, including dot entries on POSIX and entries
with the Windows hidden attribute. Nested symlinks and broken symlinks are
measured as links and never followed; FIFO, socket, device, and other special
entries are measured as their own metadata and reported as other. A root
symlink to a directory is accepted as an input convenience.
In allocated mode, observed regular-file hardlinks are counted once across the entire scan and attributed to the lexicographically smallest top-level path. Links outside the scanned tree cannot be discovered, and reflinks/filesystem clones may share physical extents even though they have distinct file identities.
Successful JSON output is exactly one array ([] when empty). Warnings and
explicit JSON progress go to stderr. Fatal validation/root-open errors and
partial scans exit with status 1; partial scans still emit the data collected so
far. Timeouts are cooperative: filesystem work checks cancellation frequently,
but an operating-system ReadDir call already blocked in the kernel cannot be
interrupted immediately.
Purpose: Search for text content within files using regex or plain text.
Key Features:
- Regex and plain text search
- Deterministic bounded-concurrency output and exact result caps
- Hidden-entry, binary, symlink, and special-file policies
- Normal streaming and bounded multiline search
- Directory listing with OS-aware hidden detection
Usage:
# Search for text
./find-content /path/to/search "search term"
# Use regex
./find-content --regex /path/to/search "pattern.*"
# Search only selected extensions
./find-content --extensions go,md /path/to/search "term"
# List a directory, including hidden entries
./find-content --list --show-hidden /path/to/searchPurpose: Advanced file and directory finder with pattern matching and filtering.
Key Features:
- Exact bounded-concurrency result caps
- Basename patterns with
*and? - Size and file-type filtering (
goand.goare equivalent) - Hidden files and directories included by default on Linux, macOS, and Windows
- TTY-aware color/progress and plain redirected output
- Partial-scan reporting and safe large-result output files
Usage:
# Find files by pattern
./find-everything /path/to/search "*.txt"
# Filter by size
./find-everything /path/to/search "*.log" --min-size 1MB --max-size 100MB
# Find specific file types; leading dots are optional
./find-everything /path/to/search "*" --file-types go,.js,py
# Disable progress even when stderr is a terminal
./find-everything /path/to/search "*.md" --no-progressPatterns apply only to each entry's basename. Quote them so the shell does not
expand them first. Brace expansion, character classes, and .gitignore
filtering are not supported. Exit statuses are 0 for complete/no-match/limit,
1 for validation or fatal output errors, 2 for partial traversal results,
and 130 for cancellation.
Purpose: Find and replace UTF-8 text in files and directory trees with explicit safety and resource limits.
Key Features:
- File and directory processing
- Optional
.bakcreation with--backup(backups are not created by default) - Multi-line replacement with
\n,\r,\t, and\\auto-unescaping - Literal and dry-run modes
- Bounded worker concurrency and streaming input/output limits
- Exact no-match and policy-skip reasons for a single target
Usage:
# Replace in single file
./replace-text "old text" "new text" file.txt
# Replace in directory
./replace-text "old text" "new text" /path/to/directory
# Handle escape sequences
./replace-text "\\n" "\\r\\n" file.txt
# Preserve backslashes instead of interpreting escape sequences
./replace-text --literal "\\n" "line break" file.txt
# Count replacements without changing files or creating backups
./replace-text --dry-run "old text" "new text" /path/to/directory
# Create a backup only for files that are modified
./replace-text --backup "old text" "new text" file.txt
# Separate flags from text that starts with a dash
./replace-text -- "--old" "--new" file.txtFlags:
--backup: create a.bakcopy for each modified file; disabled by default.--max-size <bytes>: maximum input size per file; defaults to 512 MiB (536870912bytes).--literal: do not interpret\n,\r,\t, or\\in the two text arguments.--dry-run: analyze and count replacements without creating temp files, backups, or metadata changes.--max-workers <count>: maximum concurrent file workers; defaults tomin(runtime.NumCPU(), 8)and must be at least1.--max-output-size <bytes>: maximum output size per file;0(the default) means unlimited and negative values are usage errors.
Output and exit status: A modified file keeps the compatibility line Successfully replaced text in '<path>'.. A single no-match or policy skip prints its exact human-readable reason. Directory runs retain per-file success/error lines, finish with Finished processing directory '<path>'., and print fixed-order summary counters plus a fixed-order skip breakdown. Usage errors, operational errors, and partial directory failures return 1; no-match and policy skips return 0.
Streaming and limits: Replacement uses a two-pass streaming pipeline rather than loading the entire file. Per-worker memory is bounded by O(max(64 KiB, len(old-text))), and recursive traversal uses bounded channels instead of collecting every path or result. Files that exceed the input or projected-output policy limit are left unchanged and reported as skips. Only valid UTF-8 regular files with one hard link are modified; NUL/binary data, invalid UTF-8, symlinks, hardlinks, and non-regular entries are skipped with a reason.
Platform and metadata limitations: On macOS and Linux, the tool preserves supported mode, ownership, access time, and modification time or aborts before commit when required preservation cannot be completed. Windows mode/time handling is best-effort, and owner SID preservation is not guaranteed. ACLs, extended attributes, resource forks, Linux capabilities and SELinux labels, sparse/reflink layout, and birth time are not preserved. Replacement rename is described as atomic only on macOS/Linux local filesystems; Windows, network, and removable filesystems are best-effort. Linux and Windows runtime semantics must be verified on real target machines or runners before release; cross-compilation alone verifies only that the code builds.
- Find Content: Search for function usage, API endpoints, or configuration values
- Replace Text: Bulk refactoring, configuration updates, or text standardization
- Check Folder Size: Monitor disk usage, identify large files
- Find Everything: Locate specific file types, audit file systems
- Find Content: Search logs, configuration files, or documentation
- Find Everything: Organize files by type, size, or pattern
- Replace Text: Batch file modifications with optional safety backups
- Check Folder Size: Clean up disk space efficiently
my-cli/
βββ check-folder-size/ # Disk usage analyzer
βββ find-content/ # Text search tool
βββ find-everything/ # Advanced file finder
βββ replace-text/ # Text replacement tool
βββ api-stress-test/ # API load/stress testing tool
βββ common-module/ # Shared utilities
βββ Makefile # Build & install (Linux + Windows)
Each tool is self-contained with its own go.mod file. check-folder-size
references common-module via a local replace directive; the other tools
build independently.
Use the Makefile to build and install:
# Build all
make all
# Build one tool
make find-content
# Clean build artifacts
make cleanAll tools use:
- Cobra: CLI framework for Go
- Standard library: File operations, regex, unicode handling
# Find largest directories
./check-folder-size -sort size -asc
# Exclude build artifacts
./check-folder-size -exclude-dirs "node_modules,dist,build,.git"# Find all TODO comments
./find-content /path/to/project "TODO"
# Search for specific function usage
./find-content --regex /path/to/code 'get(User|Account)'# Find all configuration files
./find-everything /path/to/config "*" --file-types json,yaml,yml,ini
# Find large log files
./find-everything /var/log "*.log" --min-size 10MB- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is open source and available under the MIT License.
For issues, feature requests, or questions:
- Check the individual tool READMEs for specific documentation
- Review the examples above
- Open an issue on the repository
Happy coding! π