sort

UK[sɔ:t] US[sɔ:rt]

n.Classification, category; quality, nature; method; a group

vt.& vi. Classify; rectify, organize; suitable for

vt. Select; classify...; arrange...

vi. Classify; communicate; coordinate

Third person singular: sorts Plural: sorts Present participle: sorting Past tense: sorted Past participle: sorted

Linux sort command syntax

Function: The sort command is used to sort the contents of text files.

Syntax: sort [-bcdfimMnr][-o<Output file>][-t<Separator character>][ <Start field>-<End Fields>][--help][--verison][File]

Linux sort command example

When using the sort command to sort the lines of the file in the default format, the command used is as follows:

sort testfile

The sort command will sort the first column of the text file in ASCII order by default. , and output the results to standard output.

Use the cat command to display the testfile file and you can see that its original sorting is as follows:

$ cat testfile      #testfile文件原有排序  
test 30  
Hello 95  
Linux 85

The results after using the sort command to rearrange are as follows:

$ sort testfile #重排结果  
Hello 95  
Linux 85  
test 30