Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
UNIX: ホーム ディレクトリに特定のファイルを持っているユーザーの数を調べるには?? 他のユーザーが使用しているファイルにアクセスする方法と同様に、そのために必要なコマンドです。findコマンドとwhoのすべての拡張子を試しました
すべてのユーザーのホーム ディレクトリが下/homeにあり、 file を持つすべてのユーザーを検索しようとしていると仮定すると、次のfoo.txtfind コマンドを使用できます。
/home
foo.txt
find /home -name "foo.txt" -exec bash -c "IFS=/ && read -a arr <<< {} && echo ${arr[2]}" \;