Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a find command that I am unsure if I am placing my arguments correctly.

find / -xdev -size -size -262144000c -o -type d \( -name .snapshot -o -name man -o -name Man -o -fstype mvfs \) -prune -o -type f

I only want to find files under 250MB that are not in .snapshot, man directories or on MVFS filesystems.

Do I need to place my size command in the brackets? Do I need to use a -a instead of a -o?

Thanks!

share|improve this question

migrated from stackoverflow.com Sep 24 '12 at 18:57

This question came from our site for professional and enthusiast programmers.

1  
Perhaps this?: find / -type d \( -name .snapshot -o -name man -o -name Man -o -fstype mvfs \) -prune -o -xdev -size -262144000c -type f -print . -a is implied between expressions if -o isn't specified. –  crw Sep 24 '12 at 15:56
    
I suggest keeping the -xdev at the beginning (after the /). If you have -xdev, I believe you don't need -fstype. Also, you could change -name man -o -name Man to -name "[Mm]an". –  Scott Sep 24 '12 at 21:55
    
@crw Please post this as an Answer :) –  nitrobass24 Sep 25 '12 at 15:37

2 Answers 2

Copying my comment to the question into an answer...

find / -type d \( -name .snapshot -o -name man -o -name Man -o -fstype mvfs \) -prune -o -xdev -size -262144000c -type f -print

-a is implied between expressions if -o isn't specified.

(I have insufficient reputation to create/edit comments, my comment migrated with the question from stackoverflow.com. However, perhaps @Scott can answer and receive benefit for his contribution, I learnt something. You should message him in the same way. Thanks.)

share|improve this answer

crw's answer is good.  Copying my comment into a supplementary answer:

  • I suggest keeping the -xdev at the beginning (after the /).
  • If you have -xdev, I believe you don't need -fstype.
  • Also, you could change  -name man -o -name Man  to  -name "[Mm]an".
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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