「find」コマンドの出力にディレクトリを表示するには?

「find」コマンドの出力にディレクトリを表示するには?

たとえば、ディレクトリ内のファイルとディレクトリを探しています。

ubuntu@example:/etc/letsencrypt$ sudo find . -name example.com*
./archive/example.com
./renewal/example.com.conf
./live/example.com
ubuntu@example:/etc/letsencrypt$ 

上記の出力でディレクトリをどのように表示できますか./archive/example.com./live/example.com

ベストアンサー1

ファイルの種類と名前を印刷するには、次のコマンドを使用します-printf "%y %p\n"

$ sudo find . -name 'example.com*' -printf "%y %p\n"
d ./archive/example.com
f ./renewal/example.com.conf
d ./live/example.com

GNUが想定されています(-printfLinuxシステムでfind最も一般的な実装)。find

おすすめ記事