Search informations in multiple files [Shell-1]

You are searching a file containing some text but don’t remember where this damn file is !

I had this problem while I was trying Drupal on my MacBook Pro. I couldn’t find the php.ini file used by MAMP, and used the following command to help me:

find /Applications/MAMP -name "*.ini" -type f -exec grep -Hn nicolas-xdebug {} \;

This command is pretty much self-explanatory but the important point is that I knew I allready add the parameter “nicolas-xdebug” from a previous test. The options H and n in grep respectively print the name of the file where the pattern is find and the line number.

The result told me that the information I search are:

  • in the file /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
  • at line 1171
  • the full line is xdebug.idekey=”nicolas-xdebug”


[Terminal-1] Search infos in multiple files - php.ini xdebug section


I can now update the PHP config file with the parameters needed by Drupal.