cmp command become really handy to quickly check if 2 files are identical or what are the differences between these files in bytes number and which are the lines has any differences between both files.
Let’s take a look at an example compare between 2 ” text, video, script, …” files any kind of files with any extension.
first.txt, and second.txt
open command line interface “Terminal”
depending on the content of these two files, the output might become like this if there are any differences.
if both files are identical it will take you to add a new command line.
Another Method
Compare the first file to the second file using bytes number.
cmp: EOF on 1.txt
These two lines shows the number of the byte in decimal and the different in octal value in the second line.
Here are more informations about cmp command, you can display it on the terminal using this command.
cmp [...]
- -b –print-bytes Print differing bytes.
- -i SKIP –ignore-initial=SKIP Skip the first SKIP bytes of input.
- -i SKIP1:SKIP2 –ignore-initial=SKIP1:SKIP2
- Skip the first SKIP1 bytes of FILE1 and the first SKIP2 bytes of FILE2.
- -l –verbose Output byte numbers and values of all differing bytes.
- -n LIMIT –bytes=LIMIT Compare at most LIMIT bytes.
- -s –quiet –silent Output nothing; yield exit status only.
- -v –version Output version info.
- –help Output this help.


Pingback: Tweets that mention Command Line | Compare File To Another Using cmp « LinuxNov -- Topsy.com
Pingback: Links 9/2/2011: LinuxQuestions.org Members Choice Award, GNOME 2.91.6, Linux 2.6.38 RC4 | Techrights
Thanks for your write-up on this site. From my own experience, occasionally softening upward a photograph may provide the digital photographer with a dose of an creative flare. Often however, that soft clouds isn’t precisely what you had planned and can frequently spoil an otherwise good snapshot, especially if you anticipate enlarging this.