🖥️fgrep

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the fgrep command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ███████╗ ██████╗ ██████╗ ███████╗██████╗ 
#                ██╔════╝██╔════╝ ██╔══██╗██╔════╝██╔══██╗
#                █████╗  ██║  ███╗██████╔╝█████╗  ██████╔╝
#                ██╔══╝  ██║   ██║██╔══██╗██╔══╝  ██╔═══╝ 
#                ██║     ╚██████╔╝██║  ██║███████╗██║     
#                ╚═╝      ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═╝     
                                                         
                                                       
#==============================#
# CMD FGREP
#==============================##==============================#

fgrep
    Fixed grep

    The fgrep command searches for fixed strings only, possibly taking the strings from another file. The "f" does not stand for "fast"; in fact, at times, using the fgrep command can be slower than using the egrep command. However, the fgrep command may still be useful when searching a file for a larger number of strings than the egrep command can handle.

fgrep --binary-files=text -C 2000 "string in file" /dev/sda > recovereddata.out
# *"Attempt"* to recover an accidentally removed file.

fgrep 22/Mar/2015 access_log |awk '$1~/\.[a-z][a-z]$/{print $6 " " $7}'
# For Mar 22nd, print the req fields for hosts from two letter gTLD

fgrep -f words.txt file1
# grep for all words which in words.txt in the file file1
# fgrep is the same as grep -F or egrep -F

fgrep = "Fixed GREP".

fgrep searches for fixed strings only. The "f" does not stand
for "fast" - in fact, "fgrep foobar *.c" is usually slower than
"egrep foobar *.c" (Yes, this is kind of surprising. Try it.)

Fgrep still has its uses though, and may be useful when searching
a file for a larger number of strings than egrep can handle.

fgrep 22/Mar/2013 access_log |awk '$1~/\.[a-z][a-z]$/{print $6 " " $7}' 
# For Mar 22nd, print the req fields for hosts from two letter gTLD

fgrep Invalid\ user auth.log | head -n 5 | awk '{ print $10 }' | ursort
fgrep Invalid\ user auth.log | wc -l
fgrep Invalid\ user auth.log | head -n 5 | awk '{ print $10 }' 188.165.201.89
fgrep Invalid\ user auth.log | head -n 5
fgrep Invalid\ user auth.log | head -n 5 | awk '{ print $10 }' | sort | uniq -c | sort -rn

#==============================##==============================#
# CMD FGREP
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░