Sort lines of text files.

# To sort a file in ascending order:
sort <filename>

# To sort a file in descending order:
sort -r <filename>

# To sort a file in case-insensitive way:
sort --ignore-case <filename>

# To sort a file using numeric rather than alphabetic order:
sort -n <filename>

# To sort the passwd file by the 3rd field, numerically:
sort -t: -k 3n /etc/passwd

# To sort a file preserving only unique lines:
sort -u <filename>

# To sort human-readable numbers (in this case the 5th field of 'ls -lh'):
ls -lh | sort -h -k 5