---
name: "sorttrans-cli"
section: "1"
platform: "linux"
package: "ledgerhelpers"
version: "0.3.10-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/sorttrans-cli"
---

# sorttrans-cli(1)

sorts a ledger file in chronological order

## NAME

sorttrans-cli - sorts a ledger file in chronological order

## SYNOPSIS

**sorttrans-cli** \[*options*\]

## OPTIONS

- **-y**

  Write back the file immediately, without showing the differences.

- **-h**,

  **--help** Show help message and exit.

- **--file FILE**

  Specify path to ledger file to work with.

- **--price-db PRICEDB**

  Specify path to ledger price database to work with.

- **--debug**

  Turn on debugging output, may be useful for developers.

## DESCRIPTION

**sorttrans-cli** is a text program for sorting a ledger in chronological order.

The program loads the ledger file and sorts the transactions in memory. Then, depending on the command-line options, it either writes the sorted file back, or invokes **meld** with the original and sorted version shown, for interactive editing.

The program must be supplied with location of the ledger file to work with. If not supplied using the command-line option **--file**, the location of the file is determined using the following mechanisms, in this order. The first mechanism which yields a result, wins.

## ENVIRONMENT

The following environment variable is recognized by this program:

- **LEDGER\_FILE**

  Path to ledger file to work with.

## FILES

The config file for [**ledger**(1)](/ledger/1.md), namely file **.ledgerrc** in user's home directory is scanned looking for the following option.

- **--file FILE**

  Path to ledger file to work with.

## SEE ALSO

[**ledger**(1)](/ledger/1.md), [**meld**(1)](/meld/1.md), [**addtrans**(1)](/addtrans/1.md), [**cleartrans-cli**(1)](/cleartrans-cli/1.md), [**sellstock-cli**(1)](/sellstock-cli/1.md), [**withdraw-cli**(1)](/withdraw-cli/1.md).
