I have new servers and copied lot of files with these conditions:

  • lot of files
  • different suffix
  • lost permissions
  • among them there are other files

now I need to set up all and only executable file - check SOLUTION.

  • 1
    Try to reword this part "Q how can I set up all and only executable file?". With self posted answer one can guess what was the initial coal . But a new user would probably be confused. – user391035 Nov 25 '14 at 2:42


  1. show files
  2. filter only with shell script header
  3. apply executable permission

find /cnn -type f | xargs grep -rl '#!/bin/sh' | xargs chmod 755

Ref thanks to: WombleGoneBad, Silver Moon, Himanshu Arora

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.