Command Line - doesn't like my syntax in the 'find' command

I am following along with a book "The Linux Command Line" by William Shotts and I'm in the chapter dealing with the Locate and the Find commands.

When I type in the following command I get an error from the shell:

christian@christian-MS-7A15:~$ find ~ (-type f -not -perm 0600 ) -or ( -type d -not -perm 0700 ) | wc -l

find: you have too many ')'

...but I'm quite sure I've typed exactly what's given in the book.

Just wondering if anyone might be able to help.

Also, I know this isn't specifically to do with Zorin OS and if need to take this question somewhere else, please let me know.



Can you please try:

find ~ (-type f -not -perm 0600) -or (-type d -not -perm 0700) | wc -l

christian@christian-MS-7A15:~$ find ~ (-type f -not -perm 0600) -or (-type d -not -perm 0700) | wc -l
find: invalid mode ‘0600)’

I copied and pasted your text into my terminal - I couldn't see a difference and still can't but there must be one since I get a different error message:
"find: invalid mode '0600)'


Ok, try:

find ~ (-type f -not -perm /0600) -or (-type d -not -perm /0700) | wc -l

I just looked it up and it appears that -perm+mode is deprecated.

That gets me the same error message with the forward slashes:

find ~ (-type f -not -perm /0600) -or (-type d -not -perm /0700) | wc -l
find: invalid mode ‘/0600)’

Deprecated... that is very interesting.  Where did you look it up?  My book is from 2019 so this must be recent.


try: find ~ \( -type f -not -perm 0600 \) -or \( -type d -not -perm 0700 \) | wc -l

Jeslin that did it! I don't understand what you did differently though.

I did have those backslash escapes in my original terminal command but they were formatted out by the forum's editor.

Also, is that -perm deprecated? If so, why does Jeslin's syntax work?


OK I believe I've figured out why Jeslin's command syntax works and mine does not. In Jeslin's post, he's separated every parenthesis and argument with a space.
So Jeslin's: "find ( type f...." works OK
And my "find (type f..." does not.

Jeslin and Aravisian thank you very much!

Perm+mode is deprecated:

jeslins command placed a backslash in each placement that will escape interpretation by the shell, thereby being just Perm and not Perm+Mode

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.