sort is a Unix command to order data in file(s) in a sequence.
sort [option] filename
-u
: Make each lines of output uniqueFull user manual of sort
is online
sort
command is used to sort a list of lines.
Input from a file
sort file.txt
Input from a command
You can sort any output command. In the example a list of file following a pattern.
find * -name pattern | sort
If each lines of the output need to be unique, add -u
option.
To display owner of files in folder
ls -l | awk '{print $3}' | sort -u
Suppose we have this file: