$ sort file1.txt file2.txt | uniq -d > matches.txt