Est. 2007
Turenki

Diff

Diff is a command-line tool, used in Terminal, to find differences in codebases, files, and folders.


To simply compare two files, use this command.

diff file1.txt file2.txt

You can also compare two folders.

diff /path/folder1 /path/folder1

To see only the filenames the differ, use ‘-q’ option.

diff -q /path/folder1 /path/folder1

Include all subfolders and files within them using recursive option ‘-r’.

diff -r /path/folder1 /path/folder1

To view just the list of files that differ and include all subfolders.

diff -rq /path/folder1 /path/folder1

To ignore certain folders on comparison, use ‘-x’.

diff -x tmp -x photos /path/folder1 /path/folder1

To view differences side by side, use ‘-y’ option.

diff -y file1.txt file2.txt

To learn more, type “man diff”.

Blog articles

60°55’1.2”N
24°38’30.4”E