How to diff two files

Just wanted to check which packages I've installed on my different Linux devices, so I wrote the package names into a file (pacman -Q > packages.txt).

But how to find the differences?

Use git: git diff --no-index --word-diff a.txt b.txt (a.txt and b.txt are the files you saved the package names in)

Source