{"id":3004,"date":"2023-01-04T08:06:03","date_gmt":"2023-01-04T08:06:03","guid":{"rendered":"https:\/\/linuxsimply.com\/?p=3004"},"modified":"2024-01-09T07:54:45","modified_gmt":"2024-01-09T07:54:45","slug":"cmp-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/","title":{"rendered":"The \u201ccmp\u201d Command in Linux [7 Practical Examples]"},"content":{"rendered":"<p style=\"text-align: justify;\">The <strong>cmp<\/strong> command in <strong>Linux<\/strong> is used for <strong>comparing<\/strong> two files byte by byte and displays the difference between the files. The command helps you to know whether the files\u2019 contents are the same or not. In this section, I will demonstrate the <strong>syntax<\/strong>, <strong>options,<\/strong> and <strong>practical applications<\/strong> of the <strong>cmp<\/strong> command in <strong>Linux<\/strong>.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#A_Description\" >A. Description<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#B_Syntax\" >B. Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#C_Options\" >C. Options<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Practical_Examples_of_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\" >Practical Examples of the \u201ccmp\u201d Command in Linux<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Example_1_Compare_Two_Identical_Files_Using_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\" >Example 1: Compare Two Identical Files Using the \u201ccmp\u201d Command in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Example_2_Compare_Two_Different_Files_Using_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\" >Example 2: Compare Two Different Files Using the \u201ccmp\u201d Command in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Example_3_Print_Differing_Bytes_of_Files_While_Comparing\" >Example 3: Print Differing Bytes of Files While Comparing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Example_4_Compare_Two_Files_Skipping_Specified_Number_of_Bytes\" >Example 4: Compare Two Files Skipping Specified Number of Bytes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Example_5_Print_Byte_Number_Value_of_Differing_Bytes_of_The_Compared_Files\" >Example 5: Print Byte Number &amp; Value of Differing Bytes of The Compared Files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Example_6_Limit_the_Number_of_Bytes_to_be_Compared\" >Example 6: Limit the Number of Bytes to be Compared<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Example_7_View_Version_Info_Using_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\" >Example 7: View Version Info Using the \u201ccmp\u201d Command in Linux<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"A_Description\"><\/span>A. Description<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Using the <strong>cmp<\/strong> command in <strong>Linux,<\/strong> you\u2019ll find whether the two files are identical or not. This command basically compares the file&#8217;s byte by byte. There\u2019s no output in the <strong>terminal <\/strong>screen if the files are identical but if the files are different the output will display the difference between the two files in the terminal.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"B_Syntax\"><\/span>B. Syntax<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The syntax of the <strong>cmp<\/strong> command in <strong>Linux<\/strong> is very easy. And the syntax is as follows:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp [OPTION]... [FILE1][FILE2]<\/code><\/pre>\n<div class=\"su-note\"  style=\"border-color:#cedfe2;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#E8F9FC;border-color:#ffffff;color:#333333;\"><strong>Note:<\/strong> In the syntax above, <strong>OPTION<\/strong> is enclosed by a square bracket and followed by 3 dots representing that more than one option can be used simultaneously. <span style=\"font-weight: 400;\">Moreover, <\/span><b>FILE1 <\/b><span style=\"font-weight: 400;\">&amp;<\/span><b> FILE2<\/b><span style=\"font-weight: 400;\"> suggest that the only two files to be compared can be specified here<\/span>.<\/div><\/div>\n<h3><span class=\"ez-toc-section\" id=\"C_Options\"><\/span>C. Options<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">There are some <strong>options<\/strong> available for the <strong>cmp<\/strong> command in <strong>Linux<\/strong>. Some of them are listed below. Although you can explore the <strong>man<\/strong> page for the <strong>cmp <\/strong>command to learn more about its options.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">man cmp<\/code><\/pre>\n<p><span style=\"color: #800080;\"><strong>Useful Options:<\/strong><\/span><\/p>\n<div class=\"su-list\" style=\"margin-left:20px\">\n<ul>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-b, <\/strong>Prints differing bytes of files<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-i,<\/strong> Compares after skipping the specified number of byte<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-l,<\/strong> Prints differing bytes of files while Comparison<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-n, <\/strong>Limits the number of bytes to be compared<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-v,<\/strong> Displays version info<\/li>\n<\/ul>\n<\/div>\n<div class=\"su-note\"  style=\"border-color:#cedfe2;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#E8F9FC;border-color:#ffffff;color:#333333;\"><strong>Note:<\/strong> The options in <strong>Linux CLI (Command Line Interface)<\/strong> are <strong>case-sensitive<\/strong>, so be cautious when you use them.<\/div><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Practical_Examples_of_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\"><\/span>Practical Examples of the \u201ccmp\u201d Command in Linux<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">The <strong>cmp <\/strong>command in <strong>Linux <\/strong>is easy as pie. This command compares two files byte by byte to see whether the files\u2019 contents are the same or not. Here you will get to know some useful examples of the <strong>cmp <\/strong>command. In this article, I have worked with the following files, you can also <strong>download<\/strong> those files to work with the same <strong>files<\/strong>.<\/p>\n<div class=\"su-button-center\"><a href=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp.zip\" class=\"su-button su-button-style-default\" style=\"color:#000000;background-color:#E8F9FF;border-color:#bac8cc;border-radius:56px\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"color:#000000;padding:8px 26px;font-size:20px;line-height:30px;border-color:#effbff;border-radius:56px;text-shadow:0px 0px 0px #000000\"><i class=\"sui sui-download\" style=\"font-size:20px;color:#1AA1D6\"><\/i> Download these files to work with the &#8220;cmp&#8221; command in Linux<\/span><\/a><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Example_1_Compare_Two_Identical_Files_Using_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\"><\/span>Example 1: Compare Two Identical Files Using the \u201ccmp\u201d Command in Linux<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To compare two identical files named <strong>1.txt<\/strong> &amp; <strong>2.txt <\/strong>I am using the <strong>cmp<\/strong> command in <strong>Linux<\/strong>. To do the same you can follow the procedure below:<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp 1.txt 2.txt<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p>\u2779 To check the files manually, type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cat 1.txt<\/code><\/pre>\n<p><span style=\"color: #800080;\"><strong>&amp;<\/strong><\/span><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cat 2.txt<\/code><\/pre>\n<p>\u278e Finally, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>In the image below, you can see that there\u2019s no output as the two files are identical.<img decoding=\"async\" class=\"aligncenter wp-image-3019 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1.png\" alt=\"Compare Two Identical Files Using the \u201ccmp\u201d Command in Linux\" width=\"580\" height=\"61\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1.png 580w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-300x32.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-1024x108.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-761x80.png 761w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-1536x162.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-2048x215.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-1426x150.png 1426w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-100x11.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-1-788x82.png 788w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/> The following image shows the contents of both files are the same.<img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-3018 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2.png\" alt=\"Compare Two Identical Files manually\" width=\"560\" height=\"147\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2.png 560w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-300x79.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-1024x269.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-766x201.png 766w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-1536x403.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-2048x538.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-571x150.png 571w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-100x26.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-1333x350.png 1333w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-2-788x206.png 788w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/p>\n<hr \/>\n<p><strong><span style=\"color: #000080; font-size: 18pt;\">Similar Readings<\/span><\/strong><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/diff-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cdiff\u201d Command in Linux [11 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/comm-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201ccomm\u201d Command in Linux [10 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<h3><span class=\"ez-toc-section\" id=\"Example_2_Compare_Two_Different_Files_Using_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\"><\/span>Example 2: Compare Two Different Files Using the \u201ccmp\u201d Command in Linux<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To compare two different files named <strong>1.txt<\/strong> &amp; <strong>2.txt <\/strong>you can use the <strong>cmp<\/strong> command in <strong>Linux<\/strong>. To do the same you can follow the procedure below:<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp 1.txt 2.txt<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p>\u2779 To check the files manually, type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cat 1.txt<\/code><\/pre>\n<p><span style=\"color: #800080;\"><strong>&amp;<\/strong><\/span><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cat 2.txt<\/code><\/pre>\n<p>\u278e Finally, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>In the image below, you can see the output displays the two files are different.<img decoding=\"async\" class=\"aligncenter wp-image-3017 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3.png\" alt=\"Compare Two Different Files Using the \u201ccmp\u201d Command in Linux\" width=\"452\" height=\"53\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3.png 452w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-300x35.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-1024x120.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-768x90.png 768w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-1536x180.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-2048x240.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-1279x150.png 1279w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-100x12.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-3-788x92.png 788w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/>The below image shows the contents of the files are different.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3016 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4.png\" alt=\"Compare Two Different Files manually\" width=\"560\" height=\"107\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4.png 560w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-300x57.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-1024x196.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-764x146.png 764w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-1536x293.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-2048x391.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-785x150.png 785w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-100x19.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-1832x350.png 1832w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-4-788x150.png 788w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_3_Print_Differing_Bytes_of_Files_While_Comparing\"><\/span>Example 3: Print Differing Bytes of Files While Comparing<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To print differing bytes while comparing two files named <strong>1.txt<\/strong> &amp; <strong>2.txt <\/strong>you can use the <strong>cmp<\/strong> command along with <strong>option -b<\/strong> in <strong>Linux<\/strong>.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp -b 1.txt 2.txt<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>In the following image, the output displays the <strong>differing bytes<\/strong> of the two files.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3015 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5.png\" alt=\"Print Differing Bytes of Files While Comparing\" width=\"825\" height=\"55\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5-300x20.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5-1024x68.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5-765x51.png 765w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5-1536x102.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5-2048x137.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5-100x7.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-5-788x52.png 788w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_4_Compare_Two_Files_Skipping_Specified_Number_of_Bytes\"><\/span>Example 4: Compare Two Files Skipping Specified Number of Bytes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To compare two files named <strong>1.txt<\/strong> &amp; <strong>2.txt<\/strong> after skipping a specified number of bytes I am using the <strong>cmp<\/strong> command with <strong>option -i<\/strong> in <strong>Linux<\/strong>. To do the same you can follow the procedure below:<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp -i 5 1.txt 2.txt<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>In the following image, the output displays the two files are compared after skipping<strong> 5<\/strong> bytes.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3014 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6.png\" alt=\"Compare Two Files Skipping Specified Number of Bytes\" width=\"662\" height=\"107\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6.png 662w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-300x48.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-1024x166.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-767x124.png 767w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-1536x248.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-2048x331.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-928x150.png 928w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-100x16.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-6-788x127.png 788w\" sizes=\"(max-width: 662px) 100vw, 662px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_5_Print_Byte_Number_Value_of_Differing_Bytes_of_The_Compared_Files\"><\/span>Example 5: Print Byte Number &amp; Value of Differing Bytes of The Compared Files<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To print the byte number &amp; value of the differing bytes of the compared files named <strong>1.txt<\/strong> &amp; <strong>2.txt<\/strong> you can use the <strong>cmp<\/strong> command with <strong>option -l<\/strong> in <strong>Linux<\/strong>. To do the same you can follow the procedure below:<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp -l 1.txt 2.txt<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>In the following image, the output displays the byte number &amp; values of the differing bytes of the compared files.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3013 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7.png\" alt=\"Print Byte Number &amp; Value of Differing Bytes of The Compared Files\" width=\"467\" height=\"344\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7.png 467w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-300x221.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-1024x754.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-767x565.png 767w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-1536x1131.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-2048x1509.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-204x150.png 204w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-100x74.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-475x350.png 475w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-7-788x580.png 788w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/p>\n<hr \/>\n<p><strong><span style=\"color: #000080; font-size: 18pt;\">Similar Readings<\/span><\/strong><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/ln-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cln\u201d Command in Linux [6 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/lsof-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201clsof\u201d Command in Linux [8 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/tar-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201ctar\u201d Command in Linux [12 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<h3><span class=\"ez-toc-section\" id=\"Example_6_Limit_the_Number_of_Bytes_to_be_Compared\"><\/span>Example 6: Limit the Number of Bytes to be Compared<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To limit the number of bytes of the compared files named <strong>1.txt<\/strong> &amp; <strong>2.txt<\/strong> I am using the <strong>cmp<\/strong> command with <strong>option -n<\/strong> in <strong>Linux<\/strong>. By limiting to n number of bytes it will just compare the first n bytes of the files. To do the same you can follow the procedure below:<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp -n 3 1.txt 2.txt<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">As you can see in the following image, the first <strong>3<\/strong> bytes of the files are compared. As the first 3 bytes of the files are identical that\u2019s why there\u2019s no output.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3012 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8.png\" alt=\"Limit the Number of Bytes to be Compared\" width=\"740\" height=\"56\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8.png 740w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-300x23.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-1024x77.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-766x58.png 766w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-1536x116.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-2048x155.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-1982x150.png 1982w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-100x8.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-8-788x59.png 788w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_7_View_Version_Info_Using_the_%E2%80%9Ccmp%E2%80%9D_Command_in_Linux\"><\/span>Example 7: View Version Info Using the \u201ccmp\u201d Command in Linux<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To view the version info I am using the <strong>cmp<\/strong> command with <strong>option -v<\/strong> . To do the same you can follow the procedure below:<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">cmp -v<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>As you can see in the image below, the output displays the <strong>version info<\/strong>.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3011 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9.png\" alt=\"View Version Info Using the \u201ccmp\u201d Command in Linux\" width=\"825\" height=\"169\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-300x61.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-1024x210.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-766x157.png 766w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-1536x315.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-2048x420.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-732x150.png 732w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-100x20.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-1709x350.png 1709w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp-9-788x161.png 788w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">In this section, I have tried to show you the <strong>cmp <\/strong>command with some practical examples in <strong>Linux<\/strong>. You\u2019ve also discovered the <strong>syntax<\/strong> and <strong>some functional options<\/strong> of this command. To become proficient in<strong> Linux<\/strong>, explore the command and its practical applications thoroughly.<\/p>\n<hr \/>\n<p><strong><span style=\"color: #000080; font-size: 18pt;\">Similar Readings<\/span><\/strong><\/p>\n<ul>\n<li><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;The \u201cchgrp\u201d Command in Linux [7 Practical Examples]&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:34620347,&quot;3&quot;:{&quot;1&quot;:0},&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16773836},&quot;6&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;7&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;8&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;10&quot;:0,&quot;11&quot;:4,&quot;12&quot;:0,&quot;17&quot;:1,&quot;23&quot;:1,&quot;28&quot;:1}\" data-sheets-hyperlink=\"https:\/\/linuxsimply.com\/chgrp-command-in-linux\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/chgrp-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">T<strong>he \u201cchgrp\u201d Command in Linux [7 Practical Examples]<\/strong><\/a><\/span><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/file-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cfile\u201d Command in Linux [9+ Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/fsck-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cfsck\u201d Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/patch-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cpatch\u201d Command in Linux [4 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/rmdir-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201crmdir\u201d Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/stat-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cstat\u201d Command in Linux [9 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;3004&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;1&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;3&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;3\\\/5 - (1 vote)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;The \u201ccmp\u201d Command in Linux [7 Practical Examples]&quot;,&quot;width&quot;:&quot;84.5&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 84.5px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            3\/5 - (1 vote)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>The cmp command in Linux is used for comparing two files byte by byte and displays the difference between the &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"The \u201ccmp\u201d Command in Linux [7 Practical Examples]\" class=\"read-more button\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#more-3004\" aria-label=\"Read more about The \u201ccmp\u201d Command in Linux [7 Practical Examples]\">Read more<\/a><\/p>\n","protected":false},"author":314895,"featured_media":3021,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[55],"class_list":["post-3004","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-commands","tag-file-management-commands","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The \u201ccmp\u201d Command in Linux [7 Practical Examples]<\/title>\n<meta name=\"description\" content=\"The cmp command in Linux is easy as pie. This command is used for comparing two files byte by byte and shows the difference between the files.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The \u201ccmp\u201d Command in Linux [7 Practical Examples]\" \/>\n<meta property=\"og:description\" content=\"The cmp command in Linux is easy as pie. This command is used for comparing two files byte by byte and shows the difference between the files.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxsimply.com\/cmp-command-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxSimply\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/jannatsylvie\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-04T08:06:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-09T07:54:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jannatul Ferdousi Sylvie\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jannatul Ferdousi Sylvie\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/\"},\"author\":{\"name\":\"Jannatul Ferdousi Sylvie\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/40ad76e7ddab94d5e04bf736331e600d\"},\"headline\":\"The \u201ccmp\u201d Command in Linux [7 Practical Examples]\",\"datePublished\":\"2023-01-04T08:06:03+00:00\",\"dateModified\":\"2024-01-09T07:54:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/\"},\"wordCount\":1219,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/cmp.png\",\"keywords\":[\"file management commands\"],\"articleSection\":[\"Linux Commands\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/\",\"name\":\"The \u201ccmp\u201d Command in Linux [7 Practical Examples]\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/cmp.png\",\"datePublished\":\"2023-01-04T08:06:03+00:00\",\"dateModified\":\"2024-01-09T07:54:45+00:00\",\"description\":\"The cmp command in Linux is easy as pie. This command is used for comparing two files byte by byte and shows the difference between the files.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/cmp.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/cmp.png\",\"width\":400,\"height\":400,\"caption\":\"cmp command in Linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/cmp-command-in-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The \u201ccmp\u201d Command in Linux [7 Practical Examples]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"name\":\"LinuxSimply\",\"description\":\"All About Linux\",\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/linuxsimply.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\",\"name\":\"LinuxSimply\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"width\":355,\"height\":48,\"caption\":\"LinuxSimply\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/40ad76e7ddab94d5e04bf736331e600d\",\"name\":\"Jannatul Ferdousi Sylvie\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Jannatul-Ferdousi-Sylvie-II-96x96.png\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Jannatul-Ferdousi-Sylvie-II-96x96.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Jannatul-Ferdousi-Sylvie-II-96x96.png\",\"caption\":\"Jannatul Ferdousi Sylvie\"},\"description\":\"Hi there! This is Jannatul Ferdousi Sylvie. I am one of the Linux Content Developer Executives at Softeko. I live in Dhaka, Bangladesh. I have completed my BSc. in Software Engineering from American International University-Bangladesh. You can see my projects in the GitHub account. I love traveling, shopping, cooking, and gardening. Read Full Bio\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/jannatsylvie\\\/\",\"https:\\\/\\\/www.instagram.com\\\/jannatsylvie\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/jannatsylvie\\\/\",\"https:\\\/\\\/www.pinterest.com\\\/JannatSylvie\\\/\"],\"url\":\"https:\\\/\\\/linuxsimply.com\\\/author\\\/sylvie\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The \u201ccmp\u201d Command in Linux [7 Practical Examples]","description":"The cmp command in Linux is easy as pie. This command is used for comparing two files byte by byte and shows the difference between the files.","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:\/\/linuxsimply.com\/cmp-command-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"The \u201ccmp\u201d Command in Linux [7 Practical Examples]","og_description":"The cmp command in Linux is easy as pie. This command is used for comparing two files byte by byte and shows the difference between the files.","og_url":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/","og_site_name":"LinuxSimply","article_author":"https:\/\/www.facebook.com\/jannatsylvie\/","article_published_time":"2023-01-04T08:06:03+00:00","article_modified_time":"2024-01-09T07:54:45+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp.png","type":"image\/png"}],"author":"Jannatul Ferdousi Sylvie","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jannatul Ferdousi Sylvie","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#article","isPartOf":{"@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/"},"author":{"name":"Jannatul Ferdousi Sylvie","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/40ad76e7ddab94d5e04bf736331e600d"},"headline":"The \u201ccmp\u201d Command in Linux [7 Practical Examples]","datePublished":"2023-01-04T08:06:03+00:00","dateModified":"2024-01-09T07:54:45+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/"},"wordCount":1219,"commentCount":0,"publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"image":{"@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp.png","keywords":["file management commands"],"articleSection":["Linux Commands"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxsimply.com\/cmp-command-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/","url":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/","name":"The \u201ccmp\u201d Command in Linux [7 Practical Examples]","isPartOf":{"@id":"https:\/\/linuxsimply.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp.png","datePublished":"2023-01-04T08:06:03+00:00","dateModified":"2024-01-09T07:54:45+00:00","description":"The cmp command in Linux is easy as pie. This command is used for comparing two files byte by byte and shows the difference between the files.","breadcrumb":{"@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxsimply.com\/cmp-command-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#primaryimage","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/cmp.png","width":400,"height":400,"caption":"cmp command in Linux"},{"@type":"BreadcrumbList","@id":"https:\/\/linuxsimply.com\/cmp-command-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/linuxsimply.com\/"},{"@type":"ListItem","position":2,"name":"The \u201ccmp\u201d Command in Linux [7 Practical Examples]"}]},{"@type":"WebSite","@id":"https:\/\/linuxsimply.com\/#website","url":"https:\/\/linuxsimply.com\/","name":"LinuxSimply","description":"All About Linux","publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linuxsimply.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/linuxsimply.com\/#organization","name":"LinuxSimply","url":"https:\/\/linuxsimply.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","width":355,"height":48,"caption":"LinuxSimply"},"image":{"@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/40ad76e7ddab94d5e04bf736331e600d","name":"Jannatul Ferdousi Sylvie","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Jannatul-Ferdousi-Sylvie-II-96x96.png","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Jannatul-Ferdousi-Sylvie-II-96x96.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Jannatul-Ferdousi-Sylvie-II-96x96.png","caption":"Jannatul Ferdousi Sylvie"},"description":"Hi there! This is Jannatul Ferdousi Sylvie. I am one of the Linux Content Developer Executives at Softeko. I live in Dhaka, Bangladesh. I have completed my BSc. in Software Engineering from American International University-Bangladesh. You can see my projects in the GitHub account. I love traveling, shopping, cooking, and gardening. Read Full Bio","sameAs":["https:\/\/www.facebook.com\/jannatsylvie\/","https:\/\/www.instagram.com\/jannatsylvie\/","https:\/\/www.linkedin.com\/in\/jannatsylvie\/","https:\/\/www.pinterest.com\/JannatSylvie\/"],"url":"https:\/\/linuxsimply.com\/author\/sylvie\/"}]}},"_links":{"self":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/3004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/users\/314895"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/comments?post=3004"}],"version-history":[{"count":0,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/3004\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media\/3021"}],"wp:attachment":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media?parent=3004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/categories?post=3004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/tags?post=3004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}