Any way to remove executable flag from many files?

Hello, I transfered a good amount of files from a NTFS drive to a LUKS EXT4 one.
I’m totally not familiar with Linux, but I can see all my transfered files have now the executable permission. My best guess is that I shouldn’t leave them like that and remove that flag from them… If that is true, is there any easy way to do so without mess things up?

I’m running Neon User Edition, and all those files are grouped up toghether in a folder and its own many subfolders.

I apologize for the probably too newbie question, and I thank you in advance for your time!

Hi.
On Unix-based file systems you can remove the execute permission from files but you almost certainly do not want to remove it from folders (it stops you navigating into those folders).

I expect this is the reason why dolphin does not provide access to the execute permission if the selection includes one or more folders.

So you can either navigate into each folder in turn, select the files (not the folders) and use the permissions tab of File Properties to remove the execute flag, or you can use the command line to do it in one go like this:

  1. Navigate in dolphin to the top level folder containing the files you want to change
  2. Press F4 to open a command window at the bottom
  3. Type this (carefully!):
find . -type f -exec chmod -x '{}' ';'

This says “Starting at the current folder (dot) find all items that are normal files (type f) and run the chmod -x command on each one to remove the execute permission”

2 Likes

May I ask if using “{}” instead of ‘{}’ and \; instead of ‘;’ would change the result?

I ask so because I’m just reading a bit about the commands find and chmod before using your solution, and in the little I did read online I see those being used instead.

i just want to be sure to don’t mess up! :laughing:

Thanks a lot for the help!

Single quotes, double quotes and backslash are all ways of preventing the command interpreter (the shell) from processing certain characters in special ways before supplying them to the find command. In this case it makes no difference which you use.

2 Likes

Thank you! Problem solved! :+1: