Grep Linux command
I like to get logs and how is actually the correct way to do this?
Example:
grep /var/log/apache2/access.log
grep /var/log/mysql/error.log
-
grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. There are hundreds of example and tutorial sites for grep if you use your favorite search engine :) As an example, if I wanted to get all the lines in the /var/log/apache2/access_log that contained the string "mod.php?mod=downloads", I could use a command like: grep "mod.php?mod=downloads" /var/log/apache2/access_log
This would output in my terminal potentially many lines of code, so I might pipe the output to a file instead eggrep "mod.php?mod=downloads" /var/log/apache2/access_log > myfile
then I can open or download myfile and deal with it at leisure :-D0 -
Hello, Let us know if you have any questions after reviewing the previous post. Thanks! 0
Please sign in to leave a comment.
Comments
2 comments