Files

283 lines
19 KiB
Markdown

# fileutils — 250 creative utilities: idea list
Each utility is ONE file in `bin/`, bash or Python 3 (stdlib only), with a header
comment (description + usage), a working `--help`, and a `--selftest` that proves
it works on sample input. Names are unique across the whole list. The bar is
NOVELTY: each tool must be something that doesn't already exist as a standard
command, or a genuinely new twist on one — not a thin wrapper around an existing
command.
Format: `NNN name | one-line description | slice`
## Slice A — File organization & dedup (001-025)
001 dustack | show which subdirectories grew most since the last snapshot (growth tracker, not just du)
002 dupfind | find duplicate files by content hash, with a keep-newest/largest policy and a dry-run plan
003 namefix | rename files to a safe portable scheme (strip weird chars, optional lowercase) with an undo log
004 exifsort | sort photos into YYYY/MM folders by EXIF/date, dry-run first
005 emptyhunt | find empty directories deepest-first, report and optionally remove
006 flatpack | flatten a nested tree into one directory, resolving name clashes with suffixes
007 splitjoin | split a file into N MB chunks and rejoin from a manifest with checksums
008 bigfind | top-N largest files with age, type and parent-dir context
009 oldfiles | files untouched for X days grouped by directory, with size totals and an archive plan
010 renumber | rename a set of files to a sequential numbered scheme, preserving extensions, with preview
011 casefix | fix filename case collisions (Foo.txt vs foo.txt) for case-insensitive filesystems
012 extfix | detect a file's real type by magic bytes and fix a wrong extension
013 dirwatch | snapshot a directory tree (names+sizes+hashes) and later diff it to show exactly what changed
014 treeclean | remove common junk (thumbs.db, .DS_Store, *~, __pycache__) with a preview and count
015 sortbyage | move files into folders by age buckets (today / this week / this month / older)
016 hashmanifest | create a sha256 manifest of a tree; verify it later
017 fileage | a file's age in human terms plus its birth time when the filesystem reports one
018 nestcount | count files by depth level in a tree (how deep is the mess?)
019 similar | find near-duplicate filenames (fuzzy match) that may be duplicates under different names
020 archage | find archives older than X days and report their compression ratios
021 copysafe | copy a tree with post-copy hash verification and resume on interruption
022 moveplan | dry-run planner: given move rules, show what would move where, then apply
023 linkcheck | find broken symlinks in a tree, with their targets
024 hardlink | find files with multiple hard links and report the link groups
025 lostfound | digital-hoarding report: files untouched 2+ years and over 100 MB
## Slice B — File content & text (026-050)
026 wordfreq | word frequency histogram with stopword filtering and a top-N bar chart
027 linecount | lines/words/chars per file in a tree, with a summary table and largest-file highlight
028 diffwords | word-level diff of two text files (not line-level)
029 csvpeek | preview a CSV: columns, inferred types, row count, nulls, sample rows
030 jsonpeek | summarize JSON structure: keys, types, depth, size, sample values
031 logtail | tail a log with colorized levels and a lines-per-second rate meter
032 textclean | normalize text: trim trailing whitespace, fix line endings, collapse blanks, ensure final newline
033 searchrep | search/replace across a tree with preview, backups, and a change count
034 uniqcount | count unique lines with frequencies, sorted
035 csvsum | sum/average/min/max a numeric CSV column, optionally grouped by another column
036 csvstat | per-column CSV statistics: distinct values, nulls, min/max
037 xmlpeek | summarize an XML file: tag counts, depth, attributes
038 lineend | detect and convert line endings (CRLF/LF/CR) with a report
039 encfix | detect and convert text encodings (UTF-8/16, latin-1) with a report
040 badlines | find overlong lines, trailing whitespace, and tabs — a lint for text files
041 headtail | show the first and last N lines of a file together (context sandwich)
042 randline | pick N random lines from a file
043 sortuniq | sort and dedupe a file in place, with a backup
044 csvjoin | join two CSVs on a key column
045 jsongrep | grep inside JSON values by key path
046 loghist | histogram of log events by hour, parsed from timestamps
047 textstat | readability stats: sentences, average word length, estimated reading time
048 hexpeek | hexdump with ASCII and highlighting of printable runs
049 tailfollow | follow a file and show only lines matching a pattern, with running counts
050 diffside | side-by-side diff of two files in the terminal, with color
## Slice C — System monitoring (051-075)
051 cpugraph | live ASCII CPU usage graph per core, read from /proc/stat, with refresh
052 memtop | top memory users with a bar chart, snapshot mode, sorted by RSS
053 proctree | process tree with CPU and memory per branch, collapsed by user
054 loadhist | record load average over time into a log and show a sparkline history
055 swapwatch | which processes use swap, how much, and the trend since last check
056 zombiefind | find zombie processes and report their parents
057 fdleak | processes with the most open file descriptors, with growth since last check
058 threadcount | processes with the most threads, top-N
059 bootlog | boot time, uptime, and load since boot in one line
060 cputemp | CPU temperature from /sys with a tiny history graph (graceful message if absent)
061 fanwatch | fan speeds from /sys/hwmon when present, graceful message otherwise
062 prochist | record one process's CPU/mem over time (sampled) and plot it after it exits
063 nicewatch | processes with unusual nice/priority values
064 oomscore | top processes by OOM score — who the kernel would kill first
065 memfrag | memory fragmentation estimate from /proc/buddyinfo
066 pressure | PSI (pressure stall information) reader with a human summary
067 schedtop | which processes are waiting on CPU (run queue) right now
068 cpufreq | current CPU frequency per core, with min/max
069 sysnap | one-shot system snapshot: load, memory, top processes, disk, network in one report
070 watchdog | watch a process and report (and optionally restart) when it dies or exceeds limits
071 prockill | interactive kill by pattern with a dry-run preview first
072 memmap | one process's memory map summary (heap, stack, libraries) in human sizes
073 iowait | processes with high I/O wait, from /proc/stat and /proc/*/io
074 topdisk | processes doing the most disk I/O right now (reads and writes)
075 kernellog | tail the kernel log with severity colors and a filter
## Slice D — Network monitoring (076-100)
076 netgraph | live ASCII traffic graph per interface, from /proc/net/dev, with refresh
077 nettop | per-process network usage, best-effort mapping from sockets to processes
078 portscan | which local ports are listening and what owns them
079 portwatch | watch a port and report when it opens or closes
080 dnstime | measure DNS resolution time for a list of hosts
081 pingraph | ping a host and draw a latency graph over time
082 conntrack | count active TCP connections by state and by remote host
083 bandwidth | total bytes in/out per interface since boot, with current rates
084 socklist | list sockets with process, state, and remote endpoint
085 wifisignal | Wi-Fi signal strength from /proc/net/wireless or iw, with fallback
086 ipinfo | all interfaces, IPs, MTU, and gateway in one table
087 latency | measure latency to several hosts and rank them
088 nettrace | trace the route to a host with per-hop latency (ping TTL method)
089 portfree | find the first free port in a range
090 connlog | log new connections over time (poll /proc/net/tcp) and report new/closed
091 dnsleak | check which DNS servers are actually used (resolv.conf plus live tests)
092 netusage | per-interface usage by hour, from snapshot deltas stored in ~/.cache
093 sshtest | test SSH connectivity to a host with timing and a banner grab
094 httpcode | fetch a URL and report status, time, size, and redirect chain
095 certcheck | a site's TLS certificate expiry date and issuer
096 netblock | which processes have the most sockets open
097 multicast | list multicast group memberships
098 arpwatch | ARP table entries with MAC, IP, and interface
099 netdown | diagnose network health: gateway, DNS, and internet, with a verdict
100 trafficlog | record interface byte counts every minute into a CSV and show daily totals
## Slice E — Disk & storage (101-125)
101 diskgraph | ASCII bar chart of disk usage by mount point
102 bigdirs | largest directories in a tree, top-N, with a tree view
103 inodehunt | directories consuming the most inodes (many small files)
104 diskfill | estimate days until a disk fills, from recent growth snapshots
105 fscheck | filesystem type, mount options, and free space per mount in one table
106 trimcheck | whether TRIM is enabled/supported, from /sys, with graceful fallback
107 diskage | files by age on a disk — what is old and big
108 mountlist | all mounts with type, size, free space, and ro/rw flag
109 diskbench | simple write/read speed test on a directory (temp file, cleaned up)
110 spacereport | full disk-space report: mounts, top directories, top files, growth
111 cacheclean | clear user caches safely (~/.cache, pip, npm) with sizes reclaimed
112 snapdiff | compare two disk-usage snapshots and show what grew
113 filetypes | disk usage by file extension in a tree (which types eat the disk)
114 emptybig | find large files that are mostly zeros (sparse files)
115 disktemp | disk temperature from SMART if smartctl is present, else /sys, else a clear message
116 raidcheck | MD RAID status from /proc/mdstat when present
117 diskio | per-device I/O stats from /proc/diskstats with rates
118 mountwatch | watch for mount/unmount events by polling /proc/mounts
119 quota | disk quota usage when set, otherwise free space
120 logrotate | tiny log rotator: compress old logs, keep N generations
121 backupcheck | verify a backup tree matches its source by hash, report missing/changed
122 synccheck | dry-run rsync-style diff between two directories (what would change)
123 diskalarm | alert when a mount crosses a usage threshold, with a one-line report
124 fatfree | find files larger than X in a tree and suggest moving them
125 treemap | ASCII treemap of disk usage by directory (nested bars)
## Slice F — Archives, conversion, checksums, metadata (126-150)
126 zipls | list zip archive contents with sizes, without extracting
127 tarpeek | list tar/tar.gz contents with a summary
128 archratio | compression ratio of the archives in a directory
129 zipcheck | verify archive integrity and report the broken ones
130 archconv | convert an archive between zip and tar.gz, with verification
131 hashfile | hash a file with several algorithms at once (md5/sha1/sha256) in one pass
132 hashdir | hash a whole tree and write a manifest
133 verifyhash | verify files against a checksum file (sha256sum format)
134 metaread | file metadata in one view: type, size, times, permissions, xattrs
135 metacopy | copy timestamps and permissions from one file to another
136 touchdate | set a file's mtime to a given date, or copy it from another file
137 permfix | normalize permissions (files 644, dirs 755) with a preview and an undo list
138 ownfix | report files in a tree not owned by the current user
139 execfix | find scripts without the executable bit, or with it but no shebang
140 csv2json | convert a flat CSV file to JSON
141 json2csv | convert a flat JSON array to CSV
142 json2yaml | convert JSON to YAML (small built-in emitter, stdlib only)
143 xml2json | convert simple XML to JSON
144 base64file | base64 encode/decode files, with a check round-trip
145 hexfile | hex encode/decode files
146 urlfile | URL-encode/decode a file or a string
147 bomfix | detect, strip, or add a BOM in text files
148 charset | detect a file's encoding (UTF-8/16/32, latin-1) with a confidence note
149 bin2txt | encode a binary file as text (base64/hex) with a decode header
150 txt2bin | decode a bin2txt file back to binary
## Slice G — Termux/Android (151-175)
Every tool in this slice must check for its termux-api command and print a clear
message when absent instead of crashing, so it degrades gracefully on plain Linux.
151 txbattery | battery status (termux-battery-status, /sys fallback)
152 txclip | clipboard get/set (termux-clipboard-get/set)
153 txnotify | send an Android notification (termux-notification)
154 txstorage | storage info (termux-storage, df fallback)
155 txvibrate | vibrate the device (termux-vibrate)
156 txtorch | torch on/off (termux-torch)
157 txwifi | Wi-Fi connection info (termux-wifi-connectioninfo)
158 txwallpaper | set the wallpaper from an image (termux-wallpaper)
159 txcontact | look up a contact by name (termux-contact-list)
160 txsms | list recent SMS messages with a count (termux-sms-list)
161 txcall | list recent calls (termux-call-log)
162 txlocation | current location with a timeout (termux-location)
163 txshare | share a file via the Android share sheet (termux-share)
164 txopen | open a file with its default app (termux-open)
165 txsensors | list sensors and their current values (termux-sensor)
166 txscan | trigger a media scan of a file or directory (termux-media-scan)
167 txbrightness | set screen brightness (termux-brightness)
168 txvolume | show and set volume levels (termux-volume)
169 txtts | speak text out loud (termux-tts-speak)
170 txdialog | show a dialog and return the choice (termux-dialog)
171 txwake | acquire/release a wake lock (termux-wake-lock/unlock)
172 txusb | list USB devices (termux-usb-list)
173 txtelephony | telephony and device info (termux-telephony-deviceinfo)
174 txdownload | download a file into Downloads (termux-download)
175 txtermux | Termux environment report: version, storage, API availability, health check
## Slice H — Time, dates, units, converters, generators (176-200)
176 datecalc | date arithmetic: add/subtract days, difference between dates, weekday
177 epoch | convert between epoch seconds and human dates, both ways
178 countdown | countdown to a date with a live display
179 stopwatch | terminal stopwatch with laps
180 pomodoro | pomodoro timer with work/break cycles and a session log
181 unitconv | convert units (length, weight, temperature, data) with a table
182 dataconv | convert data sizes (B/KB/MB/GB, bits/bytes, MiB vs MB)
183 tempconv | temperature converter (C/F/K) with a conversion table
184 passgen | generate passwords (length, symbols, word mode)
185 dice | roll dice with notation (3d6+2) and a roll history
186 randpick | pick a random item from a list or a file
187 randnum | random numbers in a range, with an optional seed
188 uuidgen | generate UUIDs (v4) and short ids
189 colorpick | pick and convert colors (hex/rgb/hsl) and show a terminal swatch
190 morse | text to Morse code and back
191 braille | text to Braille unicode and back
192 baseconv | convert numbers between bases (2/8/10/16/36)
193 romannum | convert to and from Roman numerals
194 timesheet | log time spent on tasks, with a daily summary
195 agecalc | age from a birthdate: years, days lived, next birthday
196 workdays | count working days between two dates (weekends excluded)
197 tzconv | convert a time between time zones (built-in zone table, system tzdata when present)
198 speedconv | speed converter (km/h, mph, m/s, knots)
199 currconv | currency converter with an editable offline rate file
200 quote | quote of the day (built-in list, deterministic by date)
## Slice I — Dev & shell helpers (201-225)
201 gitstat | one-page git repo summary: branch, status counts, recent commits, stashes
202 gitclean | find and remove stale git branches (merged, or with no upstream) with a preview
203 gitlog | pretty log with a graph and per-commit file stats, filtered by author/date
204 cronlist | list cron jobs with a human-readable explanation of each schedule
205 croncheck | validate a cron expression and show the next run times
206 sshkeys | list SSH keys, their fingerprints, and which are loaded in the agent
207 sshhost | known-hosts report with fingerprints
208 tmuxls | tmux/screen sessions with a summary, graceful fallback when absent
209 tmuxsave | save and restore a tmux session layout (best effort)
210 pkglist | list installed packages (apt/dpkg or pacman) with sizes, top-N
211 pkgsearch | search installed packages by name or description
212 envdiff | compare environment variables between two shells, or a file and the current env
213 pathclean | show PATH entries, flag duplicates and missing directories, print a cleaned PATH
214 aliaslist | list shell aliases and functions with their definitions
215 histstat | shell history statistics: most-used commands, usage by hour
216 scriptcheck | syntax-check all shell scripts in a directory (bash -n) and report
217 pycheck | syntax-check Python files (py_compile) and report
218 todo | find TODO/FIXME/XXX comments in a tree, with counts by file
219 codelines | count code lines by language in a tree
220 gitdiffstat | diff stats between two refs with a per-file table
221 branchage | age of git branches, sorted, with last commit
222 stashlist | list stashes with a summary of their contents
223 repocheck | health check for a git repo: uncommitted, untracked, ahead/behind, large files
224 maketool | scaffold a new utility: template file plus a test stub
225 benchcmd | benchmark a command's runtime over N runs (average, min, max)
## Slice J — Fun, creative, novel concepts (226-250)
226 banner | ASCII banner text with several built-in fonts (no figlet dependency)
227 fortune | random fortune with categories (built-in list)
228 motd | generate a message of the day from live system stats plus a quote
229 typing | typing speed test in the terminal
230 quiz | tiny quiz game with built-in questions and a score
231 hangman | hangman game in the terminal
232 memory | memory matching game in the terminal
233 maze | generate a random ASCII maze
234 life | Conway's Game of Life in the terminal for a few generations
235 starfield | short animated starfield (frame-limited, so it always exits)
236 clock | big ASCII clock, live, with a duration limit
237 calendar | month calendar with today highlighted and events read from a file
238 moonphase | moon phase calculator from the date (algorithmic, no network)
239 sunrise | sunrise/sunset calculator for a given latitude/longitude (algorithmic)
240 passphrase | generate a passphrase from a built-in wordlist
241 anagram | find anagrams of a word from a built-in wordlist
242 palindrome | check palindromes and find the longest palindromic substring
243 lorem | generate lorem ipsum text (N paragraphs)
244 fakeuser | generate a fake user profile (name, email, address) for testing
245 fakelog | generate fake log lines for testing log tools
246 fakedata | generate fake CSV data (names, ages, cities) for testing
247 timer | simple countdown timer with a message at the end
248 alarm | set an alarm (sleep, then a beep and a message)
249 focus | focus session tracker: start/stop, log, daily total
250 namegen | generate creative names for projects, pets, or bands from combinable word lists