sort

sort - sort lines of text files.


Sort a text file:

sort file.txt

Sort a text file in reverse order:

sort -r file.txt

Sort a text file using the second column:

sort -k2 file.txt

Sort a text file and remove duplicates:

sort -u file.txt