{
    "content": [
        {
            "type": "text",
            "text": "# SORT (man)\n\n## NAME\n\nsort - sort lines of text files\n\n## SYNOPSIS\n\nsort [OPTION]... [FILE]...\nsort [OPTION]... --files0-from=F\n\n## DESCRIPTION\n\nWrite sorted concatenation of all FILE(s) to standard output.\n\n## TLDR\n\n> Sort lines of text files.\n\n- Sort a file in ascending order:\n  `sort {{path/to/file}}`\n- Sort a file in descending order:\n  `sort {{-r|--reverse}} {{path/to/file}}`\n- Sort a file in case-insensitive way:\n  `sort {{-f|--ignore-case}} {{path/to/file}}`\n- Sort a file using numeric rather than alphabetic order:\n  `sort {{-n|--numeric-sort}} {{path/to/file}}`\n- Sort `/etc/passwd` by the 3rd field onward of each line numerically, using `:` as a field separator:\n  `sort {{-t|--field-separator}} : {{-k|--key}} 3n /etc/passwd`\n- As above, but when items in the 3rd field are equal, sort by the 4th field by numbers with exponents:\n  `sort {{-t|--field-separator}} : {{-k|--key}} 3,3n {{-k|--key}} 4,4g /etc/passwd`\n- Sort a file preserving only unique lines:\n  `sort {{-u|--unique}} {{path/to/file}}`\n- Sort a file, printing the output to the specified output file (can be used to sort a file in-place):\n  `sort {{-o|--output}} {{path/to/output_file}} {{path/to/input_file}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (24 subsections)\n- **AUTHOR**\n- **REPORTING BUGS**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "SORT",
        "section": "",
        "mode": "man",
        "summary": "sort - sort lines of text files",
        "synopsis": "sort [OPTION]... [FILE]...\nsort [OPTION]... --files0-from=F",
        "tldr_summary": "Sort lines of text files.",
        "tldr_examples": [
            {
                "description": "Sort a file in ascending order",
                "command": "sort {{path/to/file}}"
            },
            {
                "description": "Sort a file in descending order",
                "command": "sort {{-r|--reverse}} {{path/to/file}}"
            },
            {
                "description": "Sort a file in case-insensitive way",
                "command": "sort {{-f|--ignore-case}} {{path/to/file}}"
            },
            {
                "description": "Sort a file using numeric rather than alphabetic order",
                "command": "sort {{-n|--numeric-sort}} {{path/to/file}}"
            },
            {
                "description": "Sort `/etc/passwd` by the 3rd field onward of each line numerically, using `:` as a field separator",
                "command": "sort {{-t|--field-separator}} : {{-k|--key}} 3n /etc/passwd"
            },
            {
                "description": "As above, but when items in the 3rd field are equal, sort by the 4th field by numbers with exponents",
                "command": "sort {{-t|--field-separator}} : {{-k|--key}} 3,3n {{-k|--key}} 4,4g /etc/passwd"
            },
            {
                "description": "Sort a file preserving only unique lines",
                "command": "sort {{-u|--unique}} {{path/to/file}}"
            },
            {
                "description": "Sort a file, printing the output to the specified output file (can be used to sort a file in-place)",
                "command": "sort {{-o|--output}} {{path/to/output_file}} {{path/to/input_file}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-b",
                "long": "--ignore-leading-blanks",
                "arg": null,
                "description": "ignore leading blanks"
            },
            {
                "flag": "-d",
                "long": "--dictionary-order",
                "arg": null,
                "description": "consider only blanks and alphanumeric characters"
            },
            {
                "flag": "-f",
                "long": "--ignore-case",
                "arg": null,
                "description": "fold lower case to upper case characters"
            },
            {
                "flag": "-g",
                "long": "--general-numeric-sort",
                "arg": null,
                "description": "compare according to general numerical value"
            },
            {
                "flag": "-i",
                "long": "--ignore-nonprinting",
                "arg": null,
                "description": "consider only printable characters"
            },
            {
                "flag": "-M",
                "long": "--month-sort",
                "arg": null,
                "description": "compare (unknown) < 'JAN' < ... < 'DEC'"
            },
            {
                "flag": "-h",
                "long": "--human-numeric-sort",
                "arg": null,
                "description": "compare human readable numbers (e.g., 2K 1G)"
            },
            {
                "flag": "-n",
                "long": "--numeric-sort",
                "arg": null,
                "description": "compare according to string numerical value"
            },
            {
                "flag": "-R",
                "long": "--random-sort",
                "arg": null,
                "description": "shuffle, but group identical keys. See shuf(1) --random-source=FILE get random bytes from FILE"
            },
            {
                "flag": "-r",
                "long": "--reverse",
                "arg": null,
                "description": "reverse the result of comparisons --sort=WORD sort according to WORD: general-numeric -g, human-numeric -h, month -M, numeric -n, random -R, version -V"
            },
            {
                "flag": "-V",
                "long": "--version-sort",
                "arg": null,
                "description": "natural sort of (version) numbers within text Other options: --batch-size=NMERGE merge at most NMERGE inputs at once; for more use temp files"
            },
            {
                "flag": "-c",
                "long": "--check",
                "arg": null,
                "description": "check for sorted input; do not sort"
            },
            {
                "flag": "-C",
                "long": "--check",
                "arg": null,
                "description": "like -c, but do not report first bad line --compress-program=PROG compress temporaries with PROG; decompress them with PROG -d"
            },
            {
                "flag": "",
                "long": "--debug",
                "arg": null,
                "description": "annotate the part of the line used to sort, and warn about questionable usage to stderr --files0-from=F read input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input"
            },
            {
                "flag": "-k",
                "long": "--key",
                "arg": null,
                "description": "sort via a key; KEYDEF gives location and type"
            },
            {
                "flag": "-m",
                "long": "--merge",
                "arg": null,
                "description": "merge already sorted files; do not sort"
            },
            {
                "flag": "-o",
                "long": "--output",
                "arg": null,
                "description": "write result to FILE instead of standard output"
            },
            {
                "flag": "-s",
                "long": "--stable",
                "arg": null,
                "description": "stabilize sort by disabling last-resort comparison"
            },
            {
                "flag": "-S",
                "long": "--buffer-size",
                "arg": null,
                "description": "use SIZE for main memory buffer"
            },
            {
                "flag": "-t",
                "long": "--field-separator",
                "arg": null,
                "description": "use SEP instead of non-blank to blank transition"
            },
            {
                "flag": "-T",
                "long": "--temporary-directory",
                "arg": null,
                "description": "use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple direc‐ tories --parallel=N change the number of sorts run concurrently to N"
            },
            {
                "flag": "-u",
                "long": "--unique",
                "arg": null,
                "description": "with -c, check for strict ordering; without -c, output only the first of an equal run"
            },
            {
                "flag": "-z",
                "long": "--zero-terminated",
                "arg": null,
                "description": "line delimiter is NUL, not newline --help display this help and exit"
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "output version information and exit KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a field number and C a character position in the field; both are origin 1, and the stop position defaults to the line's end. If neither -t nor -b is in effect, characters in a field are counted from the beginning of the preceding whitespace. OPTS is one or more single-letter ordering op‐ tions [bdfgiMhnRrV], which override global ordering options for that key. If no key is given, use the entire line as the key. Use --debug to diagnose incorrect key usage. SIZE may be followed by the following multiplicative suffixes: % 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y. * WARNING * The locale specified by the environment affects sort order. Set LCALL=C to get the traditional sort order that uses native byte values."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "shuf",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/shuf/1/json"
            },
            {
                "name": "uniq",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/uniq/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": [
                    {
                        "name": "-b --ignore-leading-blanks",
                        "lines": 2,
                        "flag": "-b",
                        "long": "--ignore-leading-blanks"
                    },
                    {
                        "name": "-d --dictionary-order",
                        "lines": 2,
                        "flag": "-d",
                        "long": "--dictionary-order"
                    },
                    {
                        "name": "-f --ignore-case",
                        "lines": 2,
                        "flag": "-f",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-g --general-numeric-sort",
                        "lines": 2,
                        "flag": "-g",
                        "long": "--general-numeric-sort"
                    },
                    {
                        "name": "-i --ignore-nonprinting",
                        "lines": 2,
                        "flag": "-i",
                        "long": "--ignore-nonprinting"
                    },
                    {
                        "name": "-M --month-sort",
                        "lines": 2,
                        "flag": "-M",
                        "long": "--month-sort"
                    },
                    {
                        "name": "-h --human-numeric-sort",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--human-numeric-sort"
                    },
                    {
                        "name": "-n --numeric-sort",
                        "lines": 2,
                        "flag": "-n",
                        "long": "--numeric-sort"
                    },
                    {
                        "name": "-R --random-sort",
                        "lines": 5,
                        "flag": "-R",
                        "long": "--random-sort"
                    },
                    {
                        "name": "-r --reverse",
                        "lines": 6,
                        "flag": "-r",
                        "long": "--reverse"
                    },
                    {
                        "name": "-V --version-sort",
                        "lines": 7,
                        "flag": "-V",
                        "long": "--version-sort"
                    },
                    {
                        "name": "-c --check --check",
                        "lines": 2,
                        "flag": "-c",
                        "long": "--check"
                    },
                    {
                        "name": "-C --check --check",
                        "lines": 5,
                        "flag": "-C",
                        "long": "--check"
                    },
                    {
                        "name": "--debug",
                        "lines": 7,
                        "long": "--debug"
                    },
                    {
                        "name": "-k --key",
                        "lines": 2,
                        "flag": "-k",
                        "long": "--key"
                    },
                    {
                        "name": "-m --merge",
                        "lines": 2,
                        "flag": "-m",
                        "long": "--merge"
                    },
                    {
                        "name": "-o --output",
                        "lines": 2,
                        "flag": "-o",
                        "long": "--output"
                    },
                    {
                        "name": "-s --stable",
                        "lines": 2,
                        "flag": "-s",
                        "long": "--stable"
                    },
                    {
                        "name": "-S --buffer-size",
                        "lines": 2,
                        "flag": "-S",
                        "long": "--buffer-size"
                    },
                    {
                        "name": "-t --field-separator",
                        "lines": 2,
                        "flag": "-t",
                        "long": "--field-separator"
                    },
                    {
                        "name": "-T --temporary-directory",
                        "lines": 6,
                        "flag": "-T",
                        "long": "--temporary-directory"
                    },
                    {
                        "name": "-u --unique",
                        "lines": 2,
                        "flag": "-u",
                        "long": "--unique"
                    },
                    {
                        "name": "-z --zero-terminated",
                        "lines": 4,
                        "flag": "-z",
                        "long": "--zero-terminated"
                    },
                    {
                        "name": "--version",
                        "lines": 15,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "sort - sort lines of text files\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "sort [OPTION]... [FILE]...\nsort [OPTION]... --files0-from=F\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Write sorted concatenation of all FILE(s) to standard output.\n\nWith no FILE, or when FILE is -, read standard input.\n\nMandatory arguments to long options are mandatory for short options too.  Ordering options:\n",
                "subsections": [
                    {
                        "name": "-b --ignore-leading-blanks",
                        "content": "ignore leading blanks\n",
                        "flag": "-b",
                        "long": "--ignore-leading-blanks"
                    },
                    {
                        "name": "-d --dictionary-order",
                        "content": "consider only blanks and alphanumeric characters\n",
                        "flag": "-d",
                        "long": "--dictionary-order"
                    },
                    {
                        "name": "-f --ignore-case",
                        "content": "fold lower case to upper case characters\n",
                        "flag": "-f",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-g --general-numeric-sort",
                        "content": "compare according to general numerical value\n",
                        "flag": "-g",
                        "long": "--general-numeric-sort"
                    },
                    {
                        "name": "-i --ignore-nonprinting",
                        "content": "consider only printable characters\n",
                        "flag": "-i",
                        "long": "--ignore-nonprinting"
                    },
                    {
                        "name": "-M --month-sort",
                        "content": "compare (unknown) < 'JAN' < ... < 'DEC'\n",
                        "flag": "-M",
                        "long": "--month-sort"
                    },
                    {
                        "name": "-h --human-numeric-sort",
                        "content": "compare human readable numbers (e.g., 2K 1G)\n",
                        "flag": "-h",
                        "long": "--human-numeric-sort"
                    },
                    {
                        "name": "-n --numeric-sort",
                        "content": "compare according to string numerical value\n",
                        "flag": "-n",
                        "long": "--numeric-sort"
                    },
                    {
                        "name": "-R --random-sort",
                        "content": "shuffle, but group identical keys.  See shuf(1)\n\n--random-source=FILE\nget random bytes from FILE\n",
                        "flag": "-R",
                        "long": "--random-sort"
                    },
                    {
                        "name": "-r --reverse",
                        "content": "reverse the result of comparisons\n\n--sort=WORD\nsort  according  to  WORD: general-numeric -g, human-numeric -h, month -M, numeric -n,\nrandom -R, version -V\n",
                        "flag": "-r",
                        "long": "--reverse"
                    },
                    {
                        "name": "-V --version-sort",
                        "content": "natural sort of (version) numbers within text\n\nOther options:\n\n--batch-size=NMERGE\nmerge at most NMERGE inputs at once; for more use temp files\n",
                        "flag": "-V",
                        "long": "--version-sort"
                    },
                    {
                        "name": "-c --check --check",
                        "content": "check for sorted input; do not sort\n",
                        "flag": "-c",
                        "long": "--check"
                    },
                    {
                        "name": "-C --check --check",
                        "content": "like -c, but do not report first bad line\n\n--compress-program=PROG\ncompress temporaries with PROG; decompress them with PROG -d\n",
                        "flag": "-C",
                        "long": "--check"
                    },
                    {
                        "name": "--debug",
                        "content": "annotate the part of the line used to sort,  and  warn  about  questionable  usage  to\nstderr\n\n--files0-from=F\nread  input from the files specified by NUL-terminated names in file F; If F is - then\nread names from standard input\n",
                        "long": "--debug"
                    },
                    {
                        "name": "-k --key",
                        "content": "sort via a key; KEYDEF gives location and type\n",
                        "flag": "-k",
                        "long": "--key"
                    },
                    {
                        "name": "-m --merge",
                        "content": "merge already sorted files; do not sort\n",
                        "flag": "-m",
                        "long": "--merge"
                    },
                    {
                        "name": "-o --output",
                        "content": "write result to FILE instead of standard output\n",
                        "flag": "-o",
                        "long": "--output"
                    },
                    {
                        "name": "-s --stable",
                        "content": "stabilize sort by disabling last-resort comparison\n",
                        "flag": "-s",
                        "long": "--stable"
                    },
                    {
                        "name": "-S --buffer-size",
                        "content": "use SIZE for main memory buffer\n",
                        "flag": "-S",
                        "long": "--buffer-size"
                    },
                    {
                        "name": "-t --field-separator",
                        "content": "use SEP instead of non-blank to blank transition\n",
                        "flag": "-t",
                        "long": "--field-separator"
                    },
                    {
                        "name": "-T --temporary-directory",
                        "content": "use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple direc‐\ntories\n\n--parallel=N\nchange the number of sorts run concurrently to N\n",
                        "flag": "-T",
                        "long": "--temporary-directory"
                    },
                    {
                        "name": "-u --unique",
                        "content": "with -c, check for strict ordering; without -c, output only the first of an equal run\n",
                        "flag": "-u",
                        "long": "--unique"
                    },
                    {
                        "name": "-z --zero-terminated",
                        "content": "line delimiter is NUL, not newline\n\n--help display this help and exit\n",
                        "flag": "-z",
                        "long": "--zero-terminated"
                    },
                    {
                        "name": "--version",
                        "content": "output version information and exit\n\nKEYDEF  is  F[.C][OPTS][,F[.C][OPTS]]  for start and stop position, where F is a field number\nand C a character position in the field; both are origin 1, and the stop position defaults to\nthe  line's  end.   If neither -t nor -b is in effect, characters in a field are counted from\nthe beginning of the preceding whitespace.  OPTS is one or more  single-letter  ordering  op‐\ntions  [bdfgiMhnRrV],  which  override  global  ordering  options for that key.  If no key is\ngiven, use the entire line as the key.  Use --debug to diagnose incorrect key usage.\n\nSIZE may be followed by the following multiplicative suffixes: % 1% of memory, b  1,  K  1024\n(default), and so on for M, G, T, P, E, Z, Y.\n\n*  WARNING * The locale specified by the environment affects sort order.  Set LCALL=C to\nget the traditional sort order that uses native byte values.\n",
                        "long": "--version"
                    }
                ]
            },
            "AUTHOR": {
                "content": "Written by Mike Haertel and Paul Eggert.\n",
                "subsections": []
            },
            "REPORTING BUGS": {
                "content": "GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright © 2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3  or  later\n<https://gnu.org/licenses/gpl.html>.\nThis  is free software: you are free to change and redistribute it.  There is NO WARRANTY, to\nthe extent permitted by law.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "shuf(1), uniq(1)\n\nFull documentation <https://www.gnu.org/software/coreutils/sort>\nor available locally via: info '(coreutils) sort invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                     SORT(1)",
                "subsections": []
            }
        }
    }
}