Is there a command line to remove all "._foo.html" files in a directory on Unbuntu?

rm ./._*

more stuff since it must be at least 15 characters.


I use the following command to remove all of those annoying Apple files, but this one also does it recursively through all sub-directories, too:

# find . -iname '._*' -exec rm -rf {} \;
  • 3
    +1 I came back to my question after I realized a recursive version of this command is what I really need. Thank you for adding the answer. – Christopher Altman Jun 28 '10 at 15:14
  • 1
    awesome. This one should be accepted as answer rather than the one above. – Damodar Bashyal Mar 29 '16 at 0:15
  • 5
    Or, more simply: find . -iname "._*" -delete – dwlz Jun 22 '16 at 21:03
  • @ChristopherAltman, is this is really what you needed, you should accept this answer instead? – Steven C. Howell Aug 26 '16 at 20:56
  • 2
    -name should be sufficient instead of -iname – rooby Sep 5 '16 at 4:06

I use James' answer so often during webdevelopment I created my own command in ~/.bash_profile

alias rmd=rmdotfiles
   if [ -z "$1" ]; then
      local path=.
      local path=$1

  find $path -iname '._*' -exec rm -rf {} \;

Remember to type . ~/bash_profile after editing the file to make it available.

EDIT: Example usage: rmd /path/to/dir


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.