Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

How To Count All The Files Extension Recursively In Linux

May 09, 2023 — Gregg Szumowski

To count all the files by file extension recursively on the command line

$ find . -type f | sed -n 's/..*.//p' | sort | uniq -c
40 3g2
5 AVI
13 DS_Store
28 JPG
30 MOV
133 MP4
64 THM
1 docx
18 jpg
1 json
4 m3u
89 m4a
2 m4r
156 m4v
41 mkv
112 mov
38 mp3
587 mp4
1 nfo
2 osp
30 png
1 sh
4 srt
6 svg
10 torrent
6 txt
5 webm
10 zip

Tags: cli, motd, find, sed, sort, uniq