findコマンド
スポンサードリンク
【説明】
ディレクトリ階層下のファイルを検索する際に使用します。
find は与えられたファイル名以下のディレクトリツリーを検索します。パスが指定されない場合は、カレントディレクトリ以下を検索します。同じく与えられた評価式を左から右に
向かって優先順位の高いものから評価する (演算子のセクションを見よ)。評価式の結果が確定すると (and の左項が偽だったり、 or の左項が真だった場合など)
評価は終了し、引き続き次のファイル名が評価される。
【構文】
find [オプション] [オプション・検索条件]
例 カレントディレクトリ配下のアクセス権が777のファイルを検索します。
[root@localhost test]# ls -l
合計 12
-rwxrwxrwx 1 root root 10 6月 15 14:45 test.txt
-rw-r--r-- 1 root root 8 6月 18 08:05 test1
-rw-r--r-- 1 root root 8 6月 18 08:05 test2
[root@localhost test]# find -perm 0777 -print
./test.txt |
例 /etcディレクトリ配下のconfファイルを検索します。
[root@localhost test]# find /etc -name "*.conf" -type f -print
/etc/ld.so.conf.d/xorg-x11-i386.conf
/etc/initlog.conf
/etc/gssapi_mech.conf
/etc/modprobe.conf
/etc/wpa_supplicant/wpa_supplicant.conf
/etc/logrotate.conf
/etc/prelink.conf
/etc/lvm/lvm.conf
/etc/syslog.conf
/etc/sysctl.conf
・
・ |
|
|