Sort a file content by alphabetical order

sort file.txt

Sort file content without duplicates

sort -u file.txt

Sort file content randomly

sort -R file.txt

Sort numerically

sort -n file.txt
  • without this option file will be sorted like 1 10 11 2… rather than 1 2 3 4…