Choose your dojo

Master every interface, one skill at a time

Sort and Clean Output Quickly

What This Does

Sort command output alphabetically or remove duplicate lines to make messy lists usable.

Why It's Useful

Make messy lists usable. Sort file listings, remove duplicates from output, or organize results for easier reading.

How to Do It

  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 Now

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

Mental Hook: Make messy lists usable.