Scroll to navigation

TSORT(1) General Commands Manual TSORT(1)

NAME

tsort - Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline), ordering them based on dependencies in a directed acyclic graph (DAG). Useful for scheduling and determining execution order. If FILE is not passed in, stdin is used instead.

SYNOPSIS

tsort [-h|--help] [-V|--version] [file]

DESCRIPTION

Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline), ordering them based on dependencies in a directed acyclic graph (DAG). Useful for scheduling and determining execution order. If FILE is not passed in, stdin is used instead.

OPTIONS

Print help
Print version

VERSION

v(uutils coreutils) 0.9.0

EXAMPLES

Perform a topological sort consistent with a partial sort per line of input separated by blanks:

tsort path/to/file

Perform a topological sort consistent on strings:

echo -e "UI Backend\nBackend Database\nDocs UI" | tsort

The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail.

2026-06-04