---
title: LDIF tools
description: The makeldif command uses templates to generate sample data with great flexibility. Default templates are located in the opendj/config/MakeLDIF/ directory.
component: pingds
version: 8.1
page_id: pingds:ldap-guide:ldif-tools
canonical_url: https://docs.pingidentity.com/pingds/8.1/ldap-guide/ldif-tools.html
revdate: 2025-10-22T14:42:39Z
keywords: ["Integration", "LDAP", "Storage"]
section_ids:
  generating-ldif: Generate test data
  ldifsearch-example: Search LDIF
  ldifmodify-example: Update LDIF
  ldifdiff-example: Compare LDIF
  ldiftools-stdin: Use standard input
---

# LDIF tools

## Generate test data

The [makeldif](../tools-reference/makeldif.html) command uses templates to generate sample data with great flexibility. Default templates are located in the `opendj/config/MakeLDIF/` directory.

|   |                                                                                                                                                                                                                                                                               |
| - | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | The quickest way to generate user entries is to use the `ds-evaluation` setup profile. The profile lets you generate an arbitrary number of Example.com users as part of the setup process.For details, refer to [Install DS for evaluation](../install-guide/setup-ds.html). |

1. Write a template file for your generated LDIF.

   The `example.template` file used in the examples creates `inetOrgPerson` entries. To learn how to generate test data that matches your production data more closely, read [makeldif-template](../tools-reference/makeldif-template.html).

2. Create additional data files for your template.

   Additional data files are located in the same directory as your template file.

3. Decide whether to generate the same test data each time you use the same template.

   If so, provide the same `randomSeed` integer each time you run the command.

4. Run the `makeldif` command to generate your LDIF file.

   The following command demonstrates use of the example MakeLDIF template:

   ```console
   $ makeldif \
    --outputLdif example.ldif \
    --randomSeed 42 \
    /path/to/opendj/config/MakeLDIF/example.template
   ```

   > **Collapse: Show output**
   >
   > ```
   > LDIF processing complete.
   > ```

## Search LDIF

The `ldifsearch` command searches for entries in LDIF files:

```console
$ ldifsearch \
 --baseDN dc=example,dc=com \
 example.ldif \
 "(sn=Grenier)" \
 uid
```

> **Collapse: Show output**
>
> ```
> dn: uid=user.4630,ou=People,dc=example,dc=com
> uid: user.4630
> ```

## Update LDIF

The `ldifmodify` command applies changes, generating a new version of the LDIF.

The following [changes.ldif](../_attachments/ldif/changes.ldif) file holds the changes:

```ldif
dn: uid=user.0,ou=People,dc=example,dc=com
changetype: modify
replace: description
description: New description.
-
replace: initials
initials: ZZZ
```

This example command applies the changes:

```console
$ ldifmodify \
 --outputLdif new.ldif \
 example.ldif \
 changes.ldif
```

The resulting target LDIF file is approximately the same size as the source LDIF file. The order of entries in the file isn't guaranteed to be identical.

## Compare LDIF

The `ldifdiff` command reports differences between two LDIF files in LDIF format:

```console
$ ldifdiff example.ldif new.ldif
```

> **Collapse: Show output**
>
> ```
> dn: uid=user.0,ou=People,dc=example,dc=com
> changetype: modify
> delete: description
> description: This is the description for Aaccf Amar.
> -
> add: description
> description: New description.
> -
> delete: initials
> initials: AAA
> -
> add: initials
> initials: ZZZ
> -
> ```

The `ldifdiff` command reads files into memory to compare their contents. The command is designed to work with small files and fragments, and can quickly run out of memory when calculating the differences between large files.

## Use standard input

For each LDIF tool, a double dash, `--`, signifies the end of command options. After the double dash, only trailing arguments are allowed.

To indicate standard input as a trailing argument, use a bare dash, `-`, after the double dash. How bare dashes are used after a double dash depends on the tool:

* `ldifdiff`

  The bare dash can replace either the source LDIF file, or the target LDIF file argument.

  To take the source LDIF from standard input, use the following construction:

  ```
  ldifdiff [options] -- - target.ldif
  ```

  To take the target LDIF from standard input, use the following construction:

  ```
  ldifdiff [options] -- source.ldif -
  ```

* `ldifmodify`

  The bare dash can replace either the source.ldif or changes.ldif file arguments.

  To take the source LDIF from standard input, use the following construction:

  ```
  ldifmodify [options] -- - changes.ldif [changes.ldif ...]
  ```

  To take the changes in LDIF from standard input, use the following construction:

  ```
  ldifmodify [options] -- source.ldif -
  ```

* `ldifsearch`

  The bare dash lets you take the source LDIF from standard input with the following construction:

  ```
  ldifsearch [options] -- - filter [attributes ...]
  ```
