Linux Survival Basics
Count Source Files by Extension
You need a small inventory of source file types.
Command
find source -type f -printf '%f\n' | sed -n 's/.*\.//p' | sort | uniq -c | sort -nr
What changed
Nothing changes. The command derives extensions from filenames and counts them.
Danger
safe
When to use it
Use during backup sanity checks when a content type may be missing.
When not to use it
Do not use it for extensionless files unless you adapt the command.
Undo or recovery
No undo needed because this command is read-only.
Expected output
File extension counts sorted from most common to least common.
demo script
Disposable terminal steps
find source -type f -printf '%f\n' | sortfind source -type f -printf '%f\n' | sed -n 's/.*\.//p' | sort | uniq -c | sort -nr
simulated output
What it looks like
::fixture-ready::
$ find source -type f -printf '%f\n' | sort
about.md
config.yml
index.md
logo.svg
::exit-code::0
$ find source -type f -printf '%f\n' | sed -n 's/.*\.//p' | sort | uniq -c | sort -nr
2 md
1 yml
1 svg
::exit-code::0
YouTube Short
Count file types fast.
Count source file extensions to catch missing content classes before or after a backup.
LinkedIn hook
A quick extension count can show whether expected content made it into the source tree.
Question: Do you inventory file types when validating backups?
experiments
A/B tests to run
Metric: completion_rate
A: File type inventory.
B: Did a content class disappear?