2012-10-23 99 views

回答

5

find $HOME -type f -name "*.c" -size +2000c

看一看到-name開關的鬃毛頁:

-name pattern 
       Base of file name (the path with the leading directories 
       removed) matches shell pattern pattern. The metacharacters 
       (`*', `?', and `[]') match a `.' at the start of the base name 
       (this is a change in findutils-4.2.2; see section STANDARDS CON‐ 
       FORMANCE below). To ignore a directory and the files under it, 
       use -prune; see an example in the description of -path. Braces 
       are not recognised as being special, despite the fact that some 
       shells including Bash imbue braces with a special meaning in 
       shell patterns. The filename matching is performed with the use 
       of the fnmatch(3) library function. Don't forget to enclose 
       the pattern in quotes in order to protect it from expansion by 
       the shell. 

注意最後的建議,總是內部封閉模式引號。選項的順序不相關。曾經,再次,一看手冊頁:

EXPRESSIONS 
     The expression is made up of options (which affect overall operation 
     rather than the processing of a specific file, and always return true), 
     tests (which return a true or false value), and actions (which have 
     side effects and return a true or false value), all separated by opera‐ 
     tors. -and is assumed where the operator is omitted. 

     If the expression contains no actions other than -prune, -print is per‐ 
     formed on all files for which the expression is true. 

所以,選項,默認情況下,與和-and運營商連接:他們已經是所有真正爲了找到一個文件和順序沒有按」根本不重要。該命令可能僅適用於比-and其他運算符更復雜的模式匹配。

+0

謝謝你,順便說一句,沒有命令的順序重要的發現聲明。如果我想要,可以輸入find $ HOME -name「* c」-type f -size + 2000c嗎? – Unknown

+1

用於引用glob。 – l0b0

+1

@BernieMacinflor,不要害怕man page。用你評論的答案編輯答案。 ;) – Zagorax

0

試試這個:

find $HOME -type f -size +2000c -name *.c 
0

嘗試以下操作:

find $HOME -type f -size +2000c -name *.c 
相關問題