From 1d9591f5ed4398167722143518974e4326a58a45 Mon Sep 17 00:00:00 2001 From: Chris Jesz Date: Tue, 27 Nov 2018 13:33:07 -0500 Subject: [PATCH] Created grep page (#22842) * Created grep page Created a new file/folder for the bash grep command adding brief explanation, examples, and further information. * fix: spelling --- guide/english/bash/bash-grep/index.md | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 guide/english/bash/bash-grep/index.md diff --git a/guide/english/bash/bash-grep/index.md b/guide/english/bash/bash-grep/index.md new file mode 100644 index 0000000000..942e73cdd6 --- /dev/null +++ b/guide/english/bash/bash-grep/index.md @@ -0,0 +1,29 @@ +--- +title: Bash Grep +--- + ## Bash command: grep + `grep` stands for Global Regular Expression Print. It is used to search piped input or files for a string which can contain regex. + + ### Usage + ``` + grep + ``` + + Commonly used options: + * `-i` - Ignores the case when performing the search. + * `-v` - Inverts the search and only selects lines that do not match the search string. + + ### Examples + #### Search for IP 127.0.0.1 in the /etc/hosts file + ```bash + grep "127.0.0.1" /etc/hosts + ``` + + #### Search for oom (out of memory) in /var/log/messages + ```bash + grep -i oom /var/log/messages + ``` + + ### More Information + * run `man grep` for a full list of available flags/options to use. + * [Wikipedia](https://en.wikipedia.org/wiki/Grep)