使用指令: grep
grep -ri --include="*.php" "select data from table" /var/www/site1
上述指令為 -r 包含子目錄, -i 為不區分大小寫, --include="*.php" 為指定 php 檔案, "select data from table" 為特定內容, 最後 /var/www/site1 為指定查找的起始目錄.
grep -ir --include="file_pattern" "text_pattern" directory
這樣的方式即可順利找出對應檔案的內容囉.