Sort a list of lines alphabetically (lexicographic order), numerically, by length, or randomly. Ascending or descending.
Alphabetical uses lexicographic comparison. Numerical parses each line as a number — non-numeric lines sort to the end. By length orders shortest first (or last). Natural sort handles strings like "file2", "file10", "file20" in human order rather than as "file10", "file2", "file20". Shuffle randomizes order using Fisher-Yates.
Natural sort treats embedded numbers as numeric values. Compare "file10" vs "file2": alphabetical sort puts "file10" first (1 < 2 in ASCII), but natural sort correctly orders "file2", "file10".
Want more detail? Read How to Use Sort Lines Tool: Practical Guide and Best Practices.