I mistakenly ran chmod -x * in my /home thinking I was in a subfolder (wrong terminal). Now I'm getting all kinds of errors from different applications. Is there a way for me to detect which files exactly were modded and revert them?

2 Answers 2


If you did this in your home directory, there’s a good chance it only affected directories; you can restore the permissions there by running

chmod u+x */

This will give you execute (search) permission on all the non-hidden directories in the current directory.


To detect what files were changed:

  • Determine (or guess‪ / estimate) when you ran the chmod.  You can determine when a particular file was last changed (chmod’ed, renamed, linked to, touched, or modified) with
    ls -ldc file
    Let’s say it was 39 minutes ago.  Add three for a fudge factor, and
  • do
    find starting_directory -cmin -42 -print
    to find all files changed within the last 42 minutes.

If you don’t do this until hours after you ran the chmod -x, you may get false positives, as other files may have been changed for other reasons (by other mechanisms).

There’s no reliable way of determining which files were previously executable (other than checking a backup) — a file will appear to have been changed even if you chmod it to the mode it already had.  If you want to find all the files that were changed within the last 42 minutes and give yourself execute permission to them, do

find starting_directory -cmin -42 -exec chmod u+x {} +

This can potentially be dangerous.  If you want to do it only to directories, do

find starting_directory -type d -cmin -42 -exec chmod u+x {} +

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.