# Documentation of File Comparison And Merge

## Chapter 2. Documentation of File Comparison And Merge

## Command-Line Options

### Comparing 2 files:

       kdiff3 file1 file2

### Merging 2 files:

       kdiff3 file1 file2 -m
       kdiff3 file1 file2 -o outputfile

### Comparing 3 files:

       kdiff3 file1 file2 file3

### Merging 3 files:

       kdiff3 file1 file2 file3 -m
       kdiff3 file1 file2 file3 -o outputfile

Note that `file1` will be treated as base of `file2` and `file3`.

### Special case: Files with the same name

If all files have the same name but are in different directories, you can reduce typework by specifying the filename only for the first file. E.g.:

       kdiff3 dir1/filename dir2 dir3

### Commandline for starting a directory comparison or merge:

This is very similar, but now it's about directories.

       kdiff3 dir1 dir2
       kdiff3 dir1 dir2 -o destdir
       kdiff3 dir1 dir2 dir3
       kdiff3 dir1 dir2 dir3 -o destdir

For directory comparison and merge you can continue to read here.

### For more information on command line options use:

       kdiff3 --help
    Options:
      -m, --merge               Merge the input.
      -b, --base file           Explicit base file. For compatibility with certain tools.
      -o, --output file         Output file. Implies -m. E.g.: -o newfile.txt
      --out file                Output file, again. (For compatibility with certain tools.)
      --auto                    No GUI if all conflicts are auto-solvable. (Needs -o file)
      --qall                    Don't solve conflicts automatically. (For compatibility...)
      --L1 alias1               Visible name replacement for input file 1 (base).
      --L2 alias2               Visible name replacement for input file 2.
      --L3 alias3               Visible name replacement for input file 3.
      -L, --fname alias         Alternative visible name replacement. Supply this once for every input.
      -u                        Has no effect. For compatibility with certain tools.