Announcement

Collapse
No announcement yet.

How to revoke execute permission from all txt files in Ubuntu?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to revoke execute permission from all txt files in Ubuntu?

    How to remove execute permission from all txt files in Ubuntu?
    What is the correct command in this case?

  • #2
    You mean to say the files with a .txt extension?

    Comment


    • #3
      Yes, all *.txt files over all my partitions.

      Comment


      • #4
        Try the following command to remove the execute bit from all .txt files over all your partitions.
        find "$HOME" -type f -executable -name '*.txt' -execdir chmod a-x {} +

        Comment


        • #5
          chmod -x+X -R *

          The -x removes execute permissions for all
          The +X will add execute permissions for all, but only for directories.

          Comment


          • #6
            Do you want to do this to all files beginning from the root directory, /? Or, , just your particular files start files with your home directory. If the old, then use find / -type f -executable -name '*.txt' -execdir chmod a-x {} +

            Comment


            • #7
              Originally posted by Nimbus View Post
              Try the following command to remove the execute bit from all .txt files over all your partitions.
              find "$HOME" -type f -executable -name '*.txt' -execdir chmod a-x {} +
              With using your command, I have entered the mounted partition paths instead of $HOME where I have some .txt files.

              Comment


              • #8
                One way to do it:
                Code:
                find backup -type f -exec chmod 0644 {} +

                Comment


                • #9
                  find . -name "*.txt" -exec chmod a-x {} \;

                  find command is easy to understand. It finds the files as per specified arguments.
                  Usage: find location comparison-criteria search term

                  Comment


                  • #10
                    Thanks guys for your answer.
                    This is what I've been looking for.

                    Comment

                    Working...
                    X