find $HOME -name "hello.c" -print
これにより、システム全体$HOME(つまり/home/username/)で「hello.c」という名前のファイルが検索され、そのパス名が表示されます。
/Users/user/Downloads/hello.c
/Users/user/hello.c
しかし、それはマッチしませんHELLO.CかHellO.C。大文字と小文字を区別せずに照合するには-iname、次のようにオプションを渡します。
find $HOME -iname "hello.c" -print
出力例:
/Users/user/Downloads/hello.c
/Users/user/Downloads/Y/Hello.C
/Users/user/Downloads/Z/HELLO.c
/Users/user/hello.c
-type fファイルのみを検索するオプションを渡します。
find /dir/to/search -type f -iname "fooBar.conf.sample" -print
find $HOME -type f -iname "fooBar.conf.sample" -print
-inameバージョンfindコマンド(OS Xを含む)、GNUまたはBSD上のいずれかで動作します。お使いのバージョンのfindコマンドがをサポートしていない場合は-iname、grepコマンドを使用して次の構文を試してください。
find $HOME | grep -i "hello.c"
find $HOME -name "*" -print | grep -i "hello.c"
または試す
find $HOME -name '[hH][eE][lL][lL][oO].[cC]' -print
出力例:
/Users/user/Downloads/Z/HELLO.C
/Users/user/Downloads/Z/HEllO.c
/Users/user/Downloads/hello.c
/Users/user/hello.c
man grep、2番目の質問はで回答されman findます。なぜあなたは男を使う代わりにグーグルするのか、私にはわかりません。