The sort command is a Linux/Unix command-line utility used to sort the lines of a text file or input stream in lexicographical order (alphabetical order for text and ascending order for numbers). It's a versatile tool with various options for customizing the sorting process.
Options: The sort command has several options that allow you to customize the sorting behavior. Some common options include: -r or --reverse: Reverse the order of the sort. -n or --numeric-sort: Treats the lines as numeric values. -k or --key: Specifies a key field for sorting. -b or --ignore-leading-blanks: Ignores leading whitespace. -f or --ignore-case: Performs a case-insensitive sort. -u or --unique: Removes duplicate lines. -t or --field-separator: Specifies a field separator.
sort filename
sort -n filename
sort -r filename
sort -u filename
sort -t',' -k2,2 filename.csv
sort -n -r filename
sort -k2,2 -t' ' filename.txt
sort -m file1 file2
ls -lt | sort -k6,7
sort -R filename
sort -u -k3,3 filename.txt
du -h | sort -h
sort -t. -k1,1n -k2,2n -k3,3n -k4,4n filename.txt
sort -t',' -kNF,NF filename.csv
ls -lt --time=atime | sort -k6,7
sort -u filename
sort -n -k2,2 -k3,3 filename.txt
sort -k2,2r filename.txt
cat filename | sort | sed 's/^ *//'
sort -f -k3,3 filename.txt
sort -n -r filename
sort -k2,2n -b filename.txt
sort -k2,2 -b filename.txt
rev filename | sort | rev
sort filename | uniq -c
sort -M -k2 filename.txt
ls -lh | sort -h -k5
sort -n -k2,2 -k3,3 filename.txt
sort -f -k2,2 filename.txt
sort filename | uniq -c
sort -k3,3r filename.txt
sort -t',' -f -k2,2 filename.csv
sort -n -k1,1 -k2,2 filename.txt
sort -k2,2f -b filename.txt
sort -fu filename
sort -bu filename
sort -n -f -k2,2 -k3,3 filename.txt
sort -fu filename | uniq -ci
sort -n -f -k3,3 filename.txt
sort -n -r -k2,2 filename.txt