Sorts and/or merges files

sort [options] [field-specifier-list] [file-list]

The sort utility merges and sorts one or more text files. The sort utility takes its input from files you specify on the command line or from standard input. Without the -o option sort sends its output to standard output.


The field-specifier-list specifies one or more sort fields within each line. The sort utility uses the sort fields to sort the lines from the file-list. The file-list contains pathnames of one or more ordinary files that contain the text to be sorted. The sort utility sorts and merges the files unless you use the -m option, in which case sort only merges the files.


When you do not specify an option, sort orders the file in the ...

Get A Practical Guide to Red Hat® Linux® 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.