I have a Ubuntu 16.04 64 bit desktop in which I had installed wine in the past and later removed it. Now when I try to open txt files in nautilus, in many cases I get a dailouge box saying the file is executable and whether should I run or display it. I am annoyed by this behaviour and want to revoke execute permissions from these files. If anyone can show me how to do this it will be helpful.
Thanks
22 Answers
To remove the execute bit from all .txt files in your home directory and all its subdirectories, try:
find "$HOME" -type f -executable -name '*.txt' -execdir chmod a-x {} +How it works:
find "$HOME"This starts
findlooking for files starting with your home directory and recursively including all subdirectories-type fThis tells
findto look only for regular files, not directories.It is important to restrict the search to regular files because, if we remove the execute bit from a directory, that directory become inaccessible.
-executableThis tells
findto look only for files which have the executable bit set.-name '*.txt'This tells
findto look only for files whose names match the glob*.txt.-execdir chmod a-x {} +This tells
findto executechmod a-xon any such files found.We use
-execdir, as opposed to-exec, because it is more reliable should the names of directories change while this command is running.The
+at the end of the form-execdir chmod a-x {} +tellsfindto run fewer instances ofchmodby putting many files on eachchmodcommand line if possible.
find . -name "*.txt" -exec chmod a-x {} \;find command is self explanatory. It finds the files according to given arguments. Usage : find location comparison-criteria search term
find . -name "*.txt" -exec chmod a-x {} \; Here . means root directory, -name "*.txt" means find all files which include ".txt" in their names. -exec chmod a-x {} \; means execute the chmod command on all matching files.