Disclaimer: I am a total Linux amateur. Hi, I am currently setting up a PHPIPAM Server on CentOS 7. I am following this guide: , which tells me to run the command: "
find . -type f -exec chmod 0644 {} ;When I do so, the message:
find: missing argument for "-exec".
shows up. What can I do to get the command to work?
03 Answers
Ordinarily the ; acts as a separator between commands. However, for find -exec it needs to be provided as an actual parameter to the command itself (to indicate where the -exec option ends). To achieve that, it needs to be either quoted or escaped:
-exec ..... \;
-exec ..... ";"
-exec ..... ';' 7 When I do so, the message: 'find: missing argument for "-exec".' shows up
find . -type -exec chmod 0644 {} ;
You are missing a \ before the ; at the end of the line (which is missing in the link you quoted).
In addition, you haven't supplied an argument for -type.
Your command should be:
find . -type f -exec chmod 0644 {} \;
-type cFile is of type c as listed below:
bblock (buffered) special
ccharacter (unbuffered) special
ddirectory
pnamed pipe (FIFO)
fregular file
lsymbolic link; this is never true if the -L option or the -follow option is in effect, unless the symbolic link is broken. If you want to search for symbolic links when -L is in effect, use-xtype.
ssocket
Ddoor (Solaris)
Source find Man Page - Linux - SS64.com
3The other answers explain why the problem is happening, but there is another solution to the problem. You can use + instead of \; and then you don't have to worry about escaping the ;. For something like chmod over a large number of files, this will likely be somewhat faster, too. You would run it like this:
find . -type f -exec chmod 0644 {} +They're not exactly identical, though. With + the find command is passing multiple files as separate arguments to a single invocation of chmod. A lot of programs can handle this just fine, but some can't. If a program you want to pass to -exec needs to take exactly 1 file argument at a time, then you have to use \; instead.