How to search the contents of files in GNU/Linux
To search for files in GNU/Linux that contain a specific string of characters, we usually use the grep command.
In the following example we will look for those lines that contain the text error (error
) in the access.log file (/val/log/access.log
):
# grep error /var/log/access.log
Obviously, what may interest us most is to search for a string of characters recursively in the content of all the files in a directory and its subdirectories:
# grep -R error /var/log/