Comparing text files in bash

I wanted to compare two very large text files, one with 5M rows and another with 10M, I was seeking for the lines that where present in both files.

First of all, both files must be sorted, and the you can use the comm command.

# sort a.txt > sort_a.txt ...
more ...