# diff

*noun*

say it: **“DIF”** **/dɪf/**

A command that compares two files or folders and prints only what's different between them.

## What does **diff** do?

`diff` compares two files and prints only the lines that differ, so you don't have to read both. With `-r` it compares two folders, file by file. Saying nothing is good news: they match.

```bash
diff -r school-work restore-test && echo "The restore matches."
# The restore matches.
```

## In a sentence

- “**diff** -r printed nothing, so the restore matched the original.”
- “Sam ran **diff** to see which line of the config had changed.”

Level: Apprentice · [More Unix terms at this level](https://www.ask-codey.com/glossary?category=unix&level=2)

Updated: November 10, 2026

Source: https://www.ask-codey.com/glossary/diff
