Search files for text, get files and line numbers.
Use the find
command with grep
to find items in your project files.
Here I will search PHP files ('*.php') in my project (current directory as denoted by the period) and print out the file and line number within any file that contains a print_r statement.
$ find . -name '*.php' -print | xargs grep -Hn 'print_r';
Another example: search your computer for .lock files (Good for when your server crashes and breaks Mongo). Use 'sudo' if you don't have privileges to search all files.
$ sudo find / -name '*.lock'
Written by Chris Fidao
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#