Sorting

sorting is the arrangement of data/information in increasing (ascending) or decreasing(descending) pattern.

#sort <options> filename

Options: -r -reverse order

-n -numeric order

-t -as field separator, delimiter

-k position

-u unique sort

#sort /etc/passwd

#sort -r /etc/passwd

#cut -d:-f7 /etc/passwd|sort -u

#sort -t: -K1 /etc/passwd

Uniq: uniq moves the duplication and returns only the unique items.

# cut -d -f7 /etc/passwd|uniq -c (also counts number of counts for the item)