🖥️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.
3 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ 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
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command fgrep in a clear format. This allows users to quickly access the needed information for fgrep without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for fgrep are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.