1

Noob question

For example:

find /home/user/demo -type f -perm 777 -print -exec chmod 755 {} \;

I think I understand what this code does - it changes file permissions from 777 to 755 recursively. But I don't understand where the {} \; comes from. Is that bit part of exec or find or what?

Thanks for any help.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Lance
  • 499
  • 5
  • 6
  • I posted an answer but then found out that the question is already answered [here](http://stackoverflow.com/questions/447048/simple-unix-command-what-is-the-and-for) so I've deleted my answer and voted to close the question as duplicate. – Hristo Iliev Feb 22 '13 at 11:55

1 Answers1

4

The curly brackets are placeholders used by the find command to know where to insert the file name of the file it is currently working with.

The find command looks for a ";" to show where the command it must execute for every file ends.

We put a \ in front of it (called escaping) so the shell(ie. bash) wont interpret it, and hide it from find.

Tim De Lange
  • 739
  • 3
  • 6