Est. 2007
Turenki

Diff

Use ‘diff’ command in Terminal to find differences in codebases, files, and folders.


Compare two files

To simply compare two files, use this command.

diff file1.txt file2.txt

Compare two folders

You can also compare two folders.

diff /path/folder1 /path/folder1

Show only filenames

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

diff -q /path/folder1 /path/folder1

Include subfolders

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.

diff -rq /path/folder1 /path/folder1

Ignore folders

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

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

Viewing side-by-side

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

diff -y file1.txt file2.txt

Blog articles

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