またまたgrepのオプション 「-l」 grep -l

検索している文字列がファイルに含まれている場合
ファイル名を表示する。

[root@asenbra tmp]# ll
合計 68768
-rwxr-xr-x 1 root root 28 5月 31 05:32 2015 aaacrlf.sh
-rw-r--r-- 1 root root 5 6月 23 06:16 2015 maromaro.t
-rw-r--r-- 1 root root 584161 6月 12 12:04 2015 maromaro.tar.gz
-rw-r--r-- 1 root root 54 6月 23 06:17 2015 maromaro.txt
-rw-r--r-- 1 root root 1205 6月 22 05:20 2015 maromaro2.txt
-rw-r--r-- 1 root root 12 5月 31 23:18 2015 bbblf.txt
-rw-r--r-- 1 root root 929511 6月 12 11:52 2015 directory.txt
-rw-r--r-- 1 root root 885176 6月 3 22:26 2015 directory2.txt
-rw-r--r-- 1 root root 929499 6月 3 22:05 2015 directory2.txte
-rw-r--r-- 1 root root 885176 6月 3 22:21 2015 directory3.txt
lrwxrwxrwx 1 root root 30 6月 3 22:53 2015 jmxreport -> /directory/coherence/jmxreport
-rw-r--r-- 1 root root 105 6月 22 05:13 2015 kengo.sh
-rw-r--r-- 1 root root 173 6月 22 05:32 2015 kengo2.sh
-rw-r--r-- 1 root root 149 6月 23 06:27 2015 kengo3.sh
drwxrwxr-x 2 kenken kenken 4096 6月 12 12:45 2015 kenken
drwx------ 2 gdm gdm 4096 6月 1 05:26 2015 kkk
-rw-r--r-- 1 root root 66131288 6月 1 05:43 2015 lib.tar.gz
-rwxr-xr-x 1 root root 27 5月 31 05:31 2015 linux.sh
drwx------ 2 gdm gdm 4096 6月 26 22:00 2015 orbit-gdm
drwx------. 2 root root 4096 5月 31 05:09 2015 pulse-WOyjnA03W7Le
drwx------. 2 gdm gdm 4096 6月 26 22:00 2015 pulse-wMgYLYSRWERC
drwx------ 2 root root 4096 5月 31 05:09 2015 virtual-root.RdplKo

 

[root@asenbra tmp]# grep -l sh *.sh
aaacrlf.sh
kengo.sh
kengo2.sh
kengo3.sh
linux.sh