One of the most powerful commands on your #linux system is 'find' ... and one of the most annoying commands on your system is also find.

Do you need to use -and between parameters?

Did you specify the right #regex type before -regex search? And "./"?

Can you remember the before and after date syntax?

If you want to do something to a certain subset of files, find is probably the right way. And you'll spend fifteen minutes fixing the command-line before getting it right.

#rant #sysadmin #tips

@mikebabcock yeah, find is an odd duck. I usually don't do anything more complicated than -not -path whatever. Also -exec needs {} at the end followed by either + or \; and I often forget which is which

In case you're one of the lucky 10k, this is why I use fd on all my personal systems.

@fl0und3r I always quote both {} and ; just to make my memory simpler like:

$ find -name "*.wav" -exec flac "{}" ";"

That said I almost always end up also creating some shell script to do something more complicated so it ends up being -exec ./dothing.sh "{}" ";" instead ...