Sort and Clean

How

  1. Pipe output to sort to alphabetize: ls | sort
  2. Use sort -u to sort and remove duplicates
  3. Or use uniq to remove duplicate lines: command | uniq
  4. Combine them: ls | sort | uniq

Try this

Run ls ~ | sort to see your home directory files sorted alphabetically. Compare it to plain ls ~ to see the difference.

Why it works

Make messy lists usable.

Open full demonstration ↗