title: How to find duplicate lines across 2 different files? Unix
body: <p>From the unix terminal, we can use <code>diff file1 file2</code> to find the difference between two files. Is there a similar command to show the similarity across 2 files? (many pipes allowed if necessary.</p>
  
  <p>Each file contains a line with a string sentence; they are sorted and duplicate lines removed with <code>sort file1 | uniq</code>. </p>
  
  <p><code>file1</code>: <a href="http://pastebin.com/taRcegVn" rel="noreferrer">http://pastebin.com/taRcegVn</a></p>
  
  <p><code>file2</code>: <a href="http://pastebin.com/2fXeMrHQ" rel="noreferrer">http://pastebin.com/2fXeMrHQ</a></p>
  
  <p>And the output should output the lines that appears in both files.</p>
  
  <p><code>output</code>: <a href="http://pastebin.com/FnjXFshs" rel="noreferrer">http://pastebin.com/FnjXFshs</a></p>
  
  <p>I am able to use python to do it as such but i think it's a little too much to put into the terminal:</p>
  
  <pre><code>x = set([i.strip() for i in open('wn-rb.dic')])
  y = set([i.strip() for i in open('wn-s.dic')])
  z = x.intersection(y)
  outfile = open('reverse-diff.out')
  for i in z:
    print&gt;&gt;outfile, i
  </code></pre>