🖥️cmp

➡️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 cmp command with important options and switches using examples.

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

 #                ██████╗███╗   ███╗██████╗ 
 #               ██╔════╝████╗ ████║██╔══██╗
 #               ██║     ██╔████╔██║██████╔╝
 #               ██║     ██║╚██╔╝██║██╔═══╝ 
 #               ╚██████╗██║ ╚═╝ ██║██║     
 #                ╚═════╝╚═╝     ╚═╝╚═╝     
                                           
                                         
Cmp

The cmp command is used to perform byte-by-byte comparison of two files.

$ cmp file1 file2
file1 file2 differ: byte 1, line 1

#######################

# cmp command
# The 'cmp' command lets you carry out byte-by-byte comparison of two files. The utility provides several features in the form of command line options. In this tutorial, we will discuss some of the key options that'll give you (a beginner) a good idea about how the tool works.

cmp -b file1.txt  file2.txt
# Make cmp print differing bytes

cmp -i 10 file1.txt  file2.txt
# Make cmp skip some initial bytes from both files

cmp -i 4:7 file1.txt file2.txt
# Moving on, the tool also allows you to skip different number of bytes from both files. 

cmp -l file1.txt  file2.txt
# Make cmp display byte position (and value) for all differing bytes

cmp -n 25  file1.txt  file2.txt
# Limit number of bytes to be compared

pv file1.txt | cmp -l file3.txt > output.txt
# Display progress meter while using cmp command

cmp -s file1.txt file2.txt
# The tool also allows you to suppress the output it produces normally. This can be done using the -s command line option.

#==============================##==============================#
# CMD cmp						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

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

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

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

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