shellspells beta

uniq

uniq [OPTION]... [INPUT [OUTPUT]

Filter adjacent matching lines.

As uniq does not detect repeated lines unless they are adjacent, the input is very often sorted first using the sort utility. However, on Linux, you can miss out uniq altogether and just use 'sort -u'.

Examples

Get a list of distinct users logged into a system

who | nawk '{print $1}' | sort | uniq