find /path/to/wordpress -type f -exec chmod 664 {} \; 

It seems that it find stuffs whose type is file and then exec chmod

What does {} and \ and ; is for?


1 Answer 1


{} simply means the file returned by find, while \; it's the terminator.

Please keep in mind that \; means "execute the command for each file returned by find".

In your case

find /path/to/wordpress -type f -exec chmod 664 {} \; 

means "execute chmod 664 on each file found under /path/to/wordpress.

For example, if you have


the result is equivalento to call chmod three times:

chmod 664 /path/to/wordpress/file1
chmod 664 /path/to/wordpress/file2
chmod 664 /path/to/wordpress/file3

You can also terminate the command with \+, which passes every file found as arguments for the command.

With the example above, find /path/to/wordpress -type f -exec chmod 664 {} \+ is equivalent to a single chmod:

chmod 664 /path/to/wordpress/file1 /path/to/wordpress/file2 /path/to/wordpress/file3
  • I see and doing it with \; means doing it 3 times
    – user4951
    Sep 13, 2018 at 9:16
  • @J.Chang well, it meas do it for each file, it's 3 times because there are 3 files in the example. If there are 1000 files, it will do it 1000 times ;) Sep 13, 2018 at 9:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.