Skip to main content

Compare the contents of two files or sets of files. Use wildcards (*) to compare sets of files.

:: To compare files interactively:
comp

:: To compare two specified files:
comp <path/to/file_1> <path/to/file_2>

:: To compare two sets of files:
comp <path/to/directory_1/*> <path/to/directory_2/*>

:: To display differences in decimal format:
comp /d <path/to/file_1> <path/to/file_2>

:: To display differences in ASCII format:
comp /a <path/to/file_1> <path/to/file_2>

:: To display line numbers for differences:
comp /l <path/to/file_1> <path/to/file_2>

:: To compare files case-insensitively:
comp /c <path/to/file_1> <path/to/file_2>

:: To compare only the first 5 lines of each file:
comp /n=<5> <path/to/file_1> <path/to/file_2>