Print only lines common to both files

comm

  • Select or reject lines common to two files. Both files must be sorted.
    More information: <https://www.gnu.org/software/coreutils/comm>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

comm -12 {{file1}} {{file2}}

click the source code to copy install comm on any operating system with command-not-found.com