So I was basically trying to print all files with a .h file extention out of curiosity, and so I simply googled how to do that. Unfortunatley, I didn't pay close enough attention to the answer and just copy and pasted it, changing the file to "*.h". So, let's say I ran this for about 5 seconds before I realized what happened - is it likely a deleted anything important/unrecoverable?

Original I copied:

find . -name "*-e" -exec rm '{}' \;

My modified version:

find . -name "*.h" -exec rm '{}' \;

I also ran it from the / directory.


If you ran that command from the root directory, you (started to) remove all header files that you own from your entire filesystem. If you were silly enough to have done this as the root user, than you'll have done it system-wide to all users rather than just affecting files you own.

This won't inherently break the system itself, but will make it impossible to compile anything that relied on those header libraries. I would suggest restoring these files from the backups you assuredly have to hedge against this sort of situation or, of those are not available, you can have your package manager list installed packages, scour that list for any packages including source code, and have the package manager reinstall those packages.

  • He didn't just remove header files. Any file that is at least two characters long and ends in 'h' has potentially been removed. Hopefully he still has shells available for use. – Doug O'Neal Feb 5 at 17:24
  • No, any file that is at least two characters long and ends in .h. He used -name, not -regex. . is not a wildcard. – DopeGhoti Feb 5 at 18:32

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.