{"id":2202,"date":"2024-11-15T12:30:00","date_gmt":"2024-11-15T18:30:00","guid":{"rendered":"https:\/\/linuxhostsupport.com\/blog\/?p=2202"},"modified":"2024-11-11T09:32:33","modified_gmt":"2024-11-11T15:32:33","slug":"grep-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/","title":{"rendered":"Grep Command in Linux"},"content":{"rendered":"\n<div id=\"linux-1181458751\" class=\"linux-before-1st-paragraph linux-entity-placement\" style=\"margin-top: 15px;margin-bottom: 15px;\"><a href=\"https:\/\/www.rosehosting.com\/managed-vps-hosting\/?mtm_campaign=blogs&#038;mtm_source=lhs&#038;mtm_medium=blog&#038;mtm_content=managed-vps&#038;mtm_cid=1339&#038;mtm_placement=inline\" aria-label=\"Untitled\"><img src=\"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2020\/12\/1340090_NVMeGoogleAds_728x90_041322.jpg\" alt=\"\"  srcset=\"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2020\/12\/1340090_NVMeGoogleAds_728x90_041322.jpg 728w, https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2020\/12\/1340090_NVMeGoogleAds_728x90_041322-300x37.jpg 300w\" sizes=\"(max-width: 728px) 100vw, 728px\" width=\"728\" height=\"90\"  style=\"display: inline-block;\" \/><\/a><\/div><p>Grep is a Linux command-line utility for searching files for specific patterns that match regular expressions. The name &#8220;<strong>grep<\/strong>&#8221; is derived from the ed(editor) command <strong>g\/re\/p<\/strong>, which means searching globally for regular expressions and printing those matching lines. In other words, grep is global regular expressions print. Grep was originally developed for the Unix operating system but later became available for Unix-like and OS-9 systems such as ARM\/XScale, PowerPC, Intel x86 architecture, etc. As a command, it is used daily by system administrators, developers, and regular users familiar with Linux.<\/p>\n\n\n\n<p>In the next few paragraphs of the blog post, we will explain grep with real examples. Let&#8217;s get started!<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A server with Ubuntu 24.04 or any Linux OS<\/li>\n\n\n\n<li>User privileges: root or non-root user with sudo privileges<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Update the System<\/h2>\n\n\n\n<p>Updating the system packages to their latest versions before executing any commands on the command line is recommended. To do that, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt update -y &amp;&amp; sudo apt upgrade -y<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Syntax of grep Command<\/h2>\n\n\n\n<p>The syntax of the grep command is the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">grep [options] pattern [files]<\/pre>\n\n\n\n<p>The <strong>options<\/strong> are arguments for modifying the grep commands&#8217; behavior. The <strong>pattern <\/strong>is the keyword you want to search for, and the <strong>file <\/strong>is the content of the item you want to search for.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Available Grep Commands<\/h2>\n\n\n\n<p>This is the list of some available grep commands explained in detail:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <strong>-r<\/strong>: recursive search\n\n <strong>-c<\/strong>: print the lines with matching pattern\n\n <strong>-i<\/strong>: ignores the case-sensitive pattern\n\n <strong>-n<\/strong>: print the lines with matching patterns along with the line number\n\n <strong>-l<\/strong>: print only the name of the files with matched pattern\n\n <strong>-h<\/strong>: print the matched lines, but not the file names (opposite of <strong>-l<\/strong>)\n\n <strong>-w<\/strong>: print the whole matched word\n<\/pre>\n\n\n\n<p>In the next paragraphs, we will start with some basic grep commands and end with complex ones. We created a file with some essays about the Linux OS and will use that for our examples. You can create your file with some text to test the grep command. Let&#8217;s get things done!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Basic Search<\/h2>\n\n\n\n<p>The basic search command is used when we want to find a particular word. For example, let&#8217;s find the name <strong>Linus<\/strong> (the founder of the Linux OS) in our file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">grep Linus test.txt<\/pre>\n\n\n\n<p>The lines that contain the <strong>Linus<\/strong> word will be printed:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Linux is a trademark owned by Linus Torvalds. \nIn 1996, Linus announced that the mascot for Linux wound be a penguin. \nThis is because Linus was bitten by a penguin.\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2. Count Matches<\/h2>\n\n\n\n<p>Find and count the lines matching the given word, <strong>Linus<\/strong>. To do that, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">grep -c \"Linus\" test.txt<\/pre>\n\n\n\n<p>Instead of the printed lines, you should see only a number:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@host:~# grep -c \"Linus\" test.txt\n3\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. Display the files that match the pattern<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">To list the files, that matches the pattern <strong>Linus<\/strong> you need to execute the following command:<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">grep -l \"Linus\" *<\/pre>\n\n\n\n<p>The output is the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@host:~# grep -l \"Linus\" *\ntest.txt\n<\/pre>\n\n\n\n<p>Let&#8217;s copy the test.txt file multiple times and execute the same command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cp test.txt test2.txt; cp test.txt test3.txt<\/pre>\n\n\n\n<p>Once they are created, execute the command <strong>grep -l &#8220;Linus&#8221; *<\/strong> again.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@host:~# grep -l \"Linus\" *\ntest2.txt\ntest3.txt\ntest.txt\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. Recursive search<\/h2>\n\n\n\n<p>The next command is a recursive search of all the files and subdirectories within a folder. We will need a directory full of files and subdirectories for this command. That is why we downloaded the WordPress and extracted it into the root directory on our server.<\/p>\n\n\n\n<p>Let&#8217;s find all files that contain the famous WordPress phrase &#8220;Silence is Golden.&#8221; To do that, we need to find them recursively with the command below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">grep -r \"Silence is golden\" wordpress\/<\/pre>\n\n\n\n<p>You will get a list of the files that contain this pattern.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@host:~# grep -r \"Silence is golden\" wordpress\/\nwordpress\/wp-admin\/includes\/plugin.php\nwordpress\/wp-admin\/includes\/privacy-tools.php        \nwordpress\/wp-content\/themes\/index.php:\nwordpress\/wp-content\/plugins\/index.php:\nwordpress\/wp-content\/plugins\/akismet\/index.php:\nwordpress\/wp-content\/index.php\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">5. Case-insensitive search<\/h2>\n\n\n\n<p>The case-insensitive search will give us the pattern&#8217;s name, regardless of whether it is in upper or lower case. For example, if we add <strong>i<\/strong> in the grep command for recursive search:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">grep -ril \"silence is golden\" wordpress\/<\/pre>\n\n\n\n<p>It will give us the files as the previous command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@host:~# grep -ril \"silence is golden\" wordpress\/\nwordpress\/wp-admin\/includes\/plugin.php\nwordpress\/wp-admin\/includes\/privacy-tools.php\nwordpress\/wp-content\/themes\/index.php\nwordpress\/wp-content\/plugins\/index.php\nwordpress\/wp-content\/plugins\/akismet\/index.php\nwordpress\/wp-content\/index.php\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">6. Combination with other commands<\/h2>\n\n\n\n<p>We can combine grep with other commands as well. For example, if there are too many running services on our server and we want to know the process ID of the Apache web server, we can execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">netstat -tunlp | grep 80\n<\/pre>\n\n\n\n<p>Once executed, you should get output similar to this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@host:~# netstat -tunlp | grep 80\ntcp6       0      0 :::80                   :::*                    LISTEN      31607\/apache2 \n<\/pre>\n\n\n\n<p>The <strong>netsat<\/strong> command without <strong>grep<\/strong> will return a huge output.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More About Grep<\/h2>\n\n\n\n<p>If you want to know more about the grep command, you can execute the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">man grep<\/pre>\n\n\n\n<p>The output will be with a full description with all possible options:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">GREP(1)                                                                            User Commands                                                                            GREP(1)\n\nNAME\n       grep, egrep, fgrep, rgrep - print lines that match patterns\n\nSYNOPSIS\n       grep [OPTION...] PATTERNS [FILE...]\n       grep [OPTION...] -e PATTERNS ... [FILE...]\n       grep [OPTION...] -f PATTERN_FILE ... [FILE...]\n\nDESCRIPTION\n       grep  searches  for  PATTERNS  in each FILE.  PATTERNS is one or more patterns separated by newline characters, and grep prints each line that matches a pattern.  Typically\n       PATTERNS should be quoted when grep is used in a shell command.\n\n       A FILE of \u201c-\u201d stands for standard input.  If no FILE is given, recursive searches examine the working directory, and nonrecursive searches read standard input.\n\n       Debian also includes the variant programs egrep, fgrep and rgrep.  These programs are the  same  as  grep -E,  grep -F,  and  grep -r,  respectively.   These  variants  are\n       deprecated upstream, but Debian provides for backward compatibility. For portability reasons, it is recommended to avoid the variant programs, and use grep with the related\n       option instead.\n\nOPTIONS\n   Generic Program Information\n       --help Output a usage message and exit.\n\n       -V, --version\n              Output the version number of grep and exit.\n\n   Pattern Syntax\n       -E, --extended-regexp\n              Interpret PATTERNS as extended regular expressions (EREs, see below).\n\n       -F, --fixed-strings\n              Interpret PATTERNS as fixed strings, not regular expressions.\n\n       -G, --basic-regexp\n              Interpret PATTERNS as basic regular expressions (BREs, see below).  This is the default.\n<\/pre>\n\n\n\n<p>That&#8217;s it! You have learned some basic information about the Grep command in Linux with examples.<\/p>\n\n\n\n<p>If you have difficulties with the grep command, our Linux admins will help you with any aspect. All you have to do is <a href=\"https:\/\/linuxhostsupport.com\/monthly-server-management.html\" target=\"_blank\" rel=\"noreferrer noopener\">sign up for one of our monthly management<\/a> or <a href=\"https:\/\/linuxhostsupport.com\/per-incident-support.html\" target=\"_blank\" rel=\"noreferrer noopener\">per-incident server support plans<\/a>. Do not hesitate to contact us anytime. We are available 24\/7.<\/p>\n\n\n\n<p>PS. If you liked this post about Grep Command in Linux, please share it with your friends on social networks using the buttons on the left or leave a reply below. Thanks.<\/p><div id=\"linux-1322737628\" class=\"linux-after-8th-paragraph linux-entity-placement\" style=\"margin-top: 15px;margin-bottom: 15px;\"><a href=\"https:\/\/www.rosehosting.com\/managed-vps-hosting\/?mtm_campaign=blogs&#038;mtm_source=lhs&#038;mtm_medium=blog&#038;mtm_content=managed-vps&#038;mtm_cid=1340&#038;mtm_placement=inline\" aria-label=\"Untitled\"><img src=\"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2020\/12\/1340095_VPSGoogleAds_728x90_042622.jpg\" alt=\"\"  srcset=\"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2020\/12\/1340095_VPSGoogleAds_728x90_042622.jpg 728w, https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2020\/12\/1340095_VPSGoogleAds_728x90_042622-300x37.jpg 300w\" sizes=\"(max-width: 728px) 100vw, 728px\" width=\"728\" height=\"90\"  style=\"display: inline-block;\" \/><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Grep is a Linux command-line utility for searching files for specific patterns that match regular expressions. The name &#8220;grep&#8221; is derived from the ed(editor) command g\/re\/p, which means searching globally for regular expressions and printing those matching lines. In other words, grep is global regular expressions print. Grep was originally developed for the Unix operating [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2234,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[228],"tags":[293,292,45],"class_list":["post-2202","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-command","tag-grep","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Grep Command in Linux | LinuxHostSupport<\/title>\n<meta name=\"description\" content=\"What is Grep command in Linux? It&#039;s a command-line utility for searching files for certain patterns that match regular expressions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Grep Command in Linux | LinuxHostSupport\" \/>\n<meta property=\"og:description\" content=\"What is Grep command in Linux? It&#039;s a command-line utility for searching files for certain patterns that match regular expressions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxHostSupport\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/linuxhostsupport\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-15T18:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2024\/11\/grep-command-in-linux.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"410\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@lnxhostsupport\" \/>\n<meta name=\"twitter:site\" content=\"@lnxhostsupport\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/#\\\/schema\\\/person\\\/53a9571ea078cdf350137a1e97423cfb\"},\"headline\":\"Grep Command in Linux\",\"datePublished\":\"2024-11-15T18:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/\"},\"wordCount\":709,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/grep-command-in-linux.webp\",\"keywords\":[\"command\",\"grep\",\"linux\"],\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/\",\"url\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/\",\"name\":\"Grep Command in Linux | LinuxHostSupport\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/grep-command-in-linux.webp\",\"datePublished\":\"2024-11-15T18:30:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/#\\\/schema\\\/person\\\/53a9571ea078cdf350137a1e97423cfb\"},\"description\":\"What is Grep command in Linux? It's a command-line utility for searching files for certain patterns that match regular expressions.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/grep-command-in-linux.webp\",\"contentUrl\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/grep-command-in-linux.webp\",\"width\":742,\"height\":410,\"caption\":\"Grep Command in Linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/grep-command-in-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Grep Command in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/\",\"name\":\"LinuxHostSupport\",\"description\":\"Linux Tutorials and Guides\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/#\\\/schema\\\/person\\\/53a9571ea078cdf350137a1e97423cfb\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ed83c63a34114218f977e1f913be03906d17c7d9c800788fcac345f5edaf6cfa?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ed83c63a34114218f977e1f913be03906d17c7d9c800788fcac345f5edaf6cfa?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ed83c63a34114218f977e1f913be03906d17c7d9c800788fcac345f5edaf6cfa?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"url\":\"https:\\\/\\\/linuxhostsupport.com\\\/blog\\\/author\\\/r0s3admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Grep Command in Linux | LinuxHostSupport","description":"What is Grep command in Linux? It's a command-line utility for searching files for certain patterns that match regular expressions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"Grep Command in Linux | LinuxHostSupport","og_description":"What is Grep command in Linux? It's a command-line utility for searching files for certain patterns that match regular expressions.","og_url":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/","og_site_name":"LinuxHostSupport","article_publisher":"https:\/\/www.facebook.com\/linuxhostsupport","article_published_time":"2024-11-15T18:30:00+00:00","og_image":[{"width":742,"height":410,"url":"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2024\/11\/grep-command-in-linux.webp","type":"image\/webp"}],"author":"admin","twitter_card":"summary_large_image","twitter_creator":"@lnxhostsupport","twitter_site":"@lnxhostsupport","twitter_misc":{"Written by":"admin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#article","isPartOf":{"@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/"},"author":{"name":"admin","@id":"https:\/\/linuxhostsupport.com\/blog\/#\/schema\/person\/53a9571ea078cdf350137a1e97423cfb"},"headline":"Grep Command in Linux","datePublished":"2024-11-15T18:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/"},"wordCount":709,"commentCount":0,"image":{"@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2024\/11\/grep-command-in-linux.webp","keywords":["command","grep","linux"],"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/","url":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/","name":"Grep Command in Linux | LinuxHostSupport","isPartOf":{"@id":"https:\/\/linuxhostsupport.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2024\/11\/grep-command-in-linux.webp","datePublished":"2024-11-15T18:30:00+00:00","author":{"@id":"https:\/\/linuxhostsupport.com\/blog\/#\/schema\/person\/53a9571ea078cdf350137a1e97423cfb"},"description":"What is Grep command in Linux? It's a command-line utility for searching files for certain patterns that match regular expressions.","breadcrumb":{"@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#primaryimage","url":"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2024\/11\/grep-command-in-linux.webp","contentUrl":"https:\/\/linuxhostsupport.com\/blog\/wp-content\/uploads\/2024\/11\/grep-command-in-linux.webp","width":742,"height":410,"caption":"Grep Command in Linux"},{"@type":"BreadcrumbList","@id":"https:\/\/linuxhostsupport.com\/blog\/grep-command-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/linuxhostsupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Grep Command in Linux"}]},{"@type":"WebSite","@id":"https:\/\/linuxhostsupport.com\/blog\/#website","url":"https:\/\/linuxhostsupport.com\/blog\/","name":"LinuxHostSupport","description":"Linux Tutorials and Guides","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linuxhostsupport.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/linuxhostsupport.com\/blog\/#\/schema\/person\/53a9571ea078cdf350137a1e97423cfb","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ed83c63a34114218f977e1f913be03906d17c7d9c800788fcac345f5edaf6cfa?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ed83c63a34114218f977e1f913be03906d17c7d9c800788fcac345f5edaf6cfa?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed83c63a34114218f977e1f913be03906d17c7d9c800788fcac345f5edaf6cfa?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/linuxhostsupport.com\/blog\/author\/r0s3admin\/"}]}},"_links":{"self":[{"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/posts\/2202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/comments?post=2202"}],"version-history":[{"count":3,"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/posts\/2202\/revisions"}],"predecessor-version":[{"id":2205,"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/posts\/2202\/revisions\/2205"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/media\/2234"}],"wp:attachment":[{"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/media?parent=2202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/categories?post=2202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostsupport.com\/blog\/wp-json\/wp\/v2\/tags?post=2202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}