diff

Linux · Text · available in the simulator

What it does

Compare two files as text and display differences.

Syntax

diff [opciones] archivo1 archivo2

Options and parameters

  • -i

    Ignore case differences.

  • -b

    ignore changes in the amount of white space

  • -u

    Unified format, commonly used for patches.

    diff -u a.txt b.txt
  • -r

    Recursively compare directories.

    diff -r dir1 dir2
  • -w

    Ignore all white space.

  • -q

    Report only whether files differ.

  • -y

    Display differences in two columns.

Usage examples

  • diff f1 f2
  • diff -i f1 f2
  • diff a.txt b.txt
  • diff -u original.txt nuevo.txt
  • diff -u a.txt b.txt
  • diff -r dir1 dir2
Practise diff

Related commands