Find a code/keyword inside any of your files in seconds

//Find a code/keyword inside any of your files in seconds

Find a code/keyword inside any of your files in seconds

Sometimes you try to find a piece of code, but you are not sure which of your files it is in. In this post we discuss a tool that can find a string of text in any of your online files.

GREP

To Linux users GREP is nothing new. It is a tool that sifts through your files and tells you which contain your search query and where. For example:

  • Ask GREP to find ‘variable x’
  • GREP tells you it is found in file a, b and c on line numbers 2, 10 and 5

You can see how this would be useful.

PHP GREP

php grep screenshot

There is a php file that acts as a search engine for all files on your webserver. You basically upload it, and you can use that page to search all your files. For example:

  • You are looking for the file that contains your database settings
  • You input ‘database’
  • PHP grep tells you all the files with this keyword in it and on what line the keyword is

The setup is really simple:

  1. Download PHP GREP here
  2. Upload it to your root folder through FTP of SFTP
  3. Go to yourdomain.com/php-grep.php
  4. Input your search word

That’s it!

You can now find any code inside any of your files.

By | 2018-07-24T15:33:56+00:00 March 23rd, 2015|0 Comments