Linux terminal search
This article is dedicated to search in Linux systems.
The examples will use "egrep" but they should also work with "grep" and "zgrep".
Find the lines that contain "searched keyword". Get the third element of each row (delimiter is space). Get the unique values of the result:
egrep -a "searched keyword" /var/log/example.log | awk '{print $3}' | uniq
Recursive search for files that end with .log in the current folder:
find . -name "*.log"
Search for file name case insensitive:
find -iname "query"
Count unique rows:
sort test.txt | uniq | wc -l
Check the number of files in a directory
find <directory> -type f | wc -l
Search for no matches:
egrep "do not match" logs/*.log -v
Kill process(es) by script name
pkill -f testEmailBilling.php
Kill process(es) by name
pkill php