$ cat /post/find-files-script.md
Find files script
I can never remember the correct format of the find command so that I can recusively search through folders for a particular file or files. So I set up a scripts folder in my user folder and added it to my path in my .bash_profile, and created this text file:
#!/bin/bashfind . -name "$1"
"$1" is quoted so filenames containing spaces or shell glob characters survive the argument pass-through. Save the script as findfiles, drop it in the scripts folder on your $PATH, and mark it executable:
chmod +x findfilesfindfiles myfile.extfindfiles '*.log'
Modern alternative: fd (sudo apt install fd-find on Debian/Ubuntu, where it’s fdfind; or brew install fd on macOS) is a user-friendlier, faster find replacement that respects .gitignore by default — these days it’s usually what I reach for before falling back to find.