UNIQ(1)

πŸ’… uniq β€” the manual, but make it bestie-coded πŸ’…

okay so welcome to uniq, a.k.a. section 1 of the General Commands Manual, a.k.a. the little icon that reports or omits repeated lines. yes bestie, that's the whole job description. it reports, or it omits, the lines that keep showing up like your ex in your explore page. pick a lane, uniq said. πŸ™ˆ


✨ NAME ✨

uniq β€” Report or omit repeated lines.

like. that's it. that's the vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

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

πŸ’– DESCRIPTION πŸ’–

Report or omit repeated lines.

(iconic of her to say it twice, honestly. main character energy: concise, mysterious, unbothered. πŸ‘‘)


πŸŽ€ OPTIONS πŸŽ€

  • -D, --all-repeated[=<delimit-method>] β€” print all the duplicate lines, no crumbs left. Delimiting is done with blank lines. default is none. The possible values, bestie, are:
    • none
    • prepend
    • separate
  • --group[=<group-method>] β€” show all items, separating groups with an empty line. default is separate. Possible values:
    • separate
    • prepend
    • append
    • both
  • -w, --check-chars <N> β€” compare no more than N characters in lines. like, only look at the first N chars and mind your business about the rest. πŸ‘€
  • -c, --count β€” prefix lines by the number of occurrences. now you know how many times that line said the same thing. πŸ’€
  • -i, --ignore-case β€” ignore differences in case when comparing. HELLO and hello are the same person, we don't do case drama here. πŸ’œ
  • -d, --repeated β€” only print duplicate lines. the repeats get the spotlight, the singles get ghosted.
  • -s, --skip-chars <N> β€” avoid comparing the first N characters. skip past the intro, straight to the plot. ✨
  • -f, --skip-fields <N> β€” avoid comparing the first N fields. yes bestie, fields. different unit than chars. don't mix them up.
  • -u, --unique β€” only print unique lines. one of one. no dupes allowed. 🌈
  • -z, --zero-terminated β€” end lines with 0 byte, not newline. chaotic but valid. πŸ”₯
  • -h, --help β€” Print help. she's helpful, she's humble, she's everything.
  • -V, --version β€” Print version. for the girlies who need receipts. 🧚

πŸ”₯ EXTRA πŸ”₯

Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output).

⚠️ Note, and this is the important bit, bestie: uniq does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use sort -u without uniq. that's the whole plot twist. uniq is not a mind reader, she only checks who's standing next to who. adjacent or it didn't happen. 😭

⭐ VERSION ⭐

v(uutils coreutils) 0.12.0


πŸ’« EXAMPLES πŸ’«

Display each line once:

sort path/to/file | uniq

Display only unique lines:

sort path/to/file | uniq [-u|--unique]

Display only duplicate lines:

sort path/to/file | uniq [-d|--repeated]

Display number of occurrences of each line along with that line:

sort path/to/file | uniq [-c|--count]

Display number of occurrences of each line, sorted by the most frequent:

sort path/to/file | uniq [-c|--count] | sort [-nr|--numeric-sort --reverse]

Compare only the first 10 characters on each line for uniqueness:

sort path/to/file | uniq [-w|--check-chars] 10

Compare text after the first 5 characters on each line for uniqueness:

sort path/to/file | uniq [-s|--skip-chars] 5
πŸ’Œ The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. (not her fault, she's growing. 🫢)

and that's the page, bestie. this was UNIQ(1), hand-delivered to you by uutils coreutils, version 0.12.0, dated 2026-09-25. slay, stay adjacent, and sort your input first. periodt. πŸ’…βœ¨πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from