---
name: "difference"
section: "1"
platform: "linux"
package: "difference"
version: "2.0.0-1+b14"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/difference"
---

# difference(1)

compares two strings and prints a colorful diff

## NAME

difference - compares two strings and prints a colorful diff

## SYNOPSIS

**difference** \[**--split** *split*\] *orig* *edit*

## DESCRIPTION

**difference** compares the strings *orig* and *edit* and prints a colorful representation of the difference to the standard output.

## OPTIONS

- **-s**, **--split** **char**\|**word**\|**line**

  Select the level of detail in the diff (default:  **word**).

## EXAMPLES

In the examples, text that would be printed in red is formatted *in* *italics*, and text that would be printed in green is formatted **bold**.

Compare characters:\
     $ **difference --split char brown green**\
     *b***g**r*ow***ee**n

Compare words:\
     $ **difference --split word brown green**\
     *brown* **green**

    $ **difference --split word "The quick brown fox jumps over the lazy dog." "The huge brown fox is cool."**\
     The *quick* **huge** brown fox *jumps over the lazy dog.* **is really cool.**

Compare lines:\
     $ **difference --split word brown green**\
     *brown*\
     **green**

    $ **difference --split word "The quick brown fox jumps over the lazy dog." "The huge brown fox is cool."**\
     *The quick brown fox jumps over the lazy dog.*\
     **The huge brown fox is cool.**

    $ **difference --split line "Roses are red, violets are blue,**\
     \> **I wrote this library here,**\
     \> **just for you.**\
     \> **(It's true)." "Roses are red, violets are blue,**\
     \> **I wrote this documentation here,**\
     \> **just for you.**\
     \> (**It's quite true)."**\
     Roses are red, violets are blue,\
     *I wrote this library here,*\
     **I wrote this documentation here,**\
     just for you.\
     *(It's true).*\
     **(It's quite true).**
