Welcome, guest | Sign In | My Account | Store | Cart

As the title says ...

It prints True if the files compared are the same, and False if they differ (either in size or in content).

Python, 1 line
1
python -c "print open('f0.txt', 'rb').read() == open('f1.txt', 'rb').read()"

The one-liner is straightforward: It reads (slurps, to use the Perl term) both files into strings in memory, and then compares the two strings. So it can only work when the total size of the two files is less than the free memory in your computer at that time.