Skip to content

sort

The sort command orders records by one or more fields, in ascending or descending order.

Syntax

sort FIELD_NAME [asc|desc], ...
  • FIELD_NAME: The fields to sort by.
  • asc: Sort in ascending order (default).
  • desc: Sort in descending order.

Usage

  • Use sort to control the order of results in the output table or view.
  • Multiple fields can be specified for multi-level sorting.

Example

sort -timestamp, user

This sorts results by timestamp descending, then by user ascending`.