课程: Ubuntu Linux: Essential Commands

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Compare non-text files

Compare non-text files

- [Instructor] Though we can't usually make sense of differences in binary files ourselves as we can when comparing text files line by line, we can compare their type, their size, and other secondary aspects of them. We can even compare the contents. Though at a byte for byte level rather than reading differences in words. Comparing binaries byte for byte can be accomplished with the cmp command line tool which will tell you where files differ. Here we can compare our text files from earlier. But instead of interpreting them as eight bit ASCI text, we read them for their byte values directly. Cmp without any other options, tells us the location or address of where the first difference in the files exists. If they're identical, you'll just get no output. Here I can see that these files begin to differ at byte 27. To see a list of all the locations where the bytes differ, You can use the -l option. I'll write cmp -l text1.txt text2.txt. And here's a list of all of the different bytes…

内容