UNIQ(1)
๐ UNIQ(1) โ the uniq girlies' guide ๐
okay so bestie, welcome to uniq, from the User Commands chapter. she's a little filter with big main character energy and she's about to change your whole text-processing life. no cap. โจ
๐ธ NAME ๐ธ
uniq โ report or omit repeated lines. that's it. that's the vibe. she looks at your lines, notices when the same one shows up again right after itself, and decides what to do about it. iconic behaviour honestly. ๐
๐ฆ SYNOPSIS ๐ฆ
uniq [OPTION]... [INPUT [OUTPUT]]
โจ DESCRIPTION โจ
she filters adjacent matching lines from INPUT (or standard input if you don't give her one), and writes the result to OUTPUT (or standard output). simple as that, fr fr. ๐ซถ
with no options, matching lines get merged down to the first occurrence. so if you feed her the same line three times in a row, you get it back once. slay.
mandatory arguments to long options are mandatory for short options too. yes, that means what you think it means โ if a long option needs a value, the short version needs it too. don't try to be cute about it. ๐
here come the options, and there are a lot of them, so buckle up buttercup:
-c,--countโ prefixes each line with the number of times it occurred. so you can see how many times the group showed up. obsessed. ๐ฅ-d,--repeatedโ only prints the duplicate lines, one per group. she's showing you the repeats and nothing else. ๐-Dโ prints all the duplicate lines. like, every single one of them, not just one per group. all gas no brakes. ๐--all-repeated[=METHOD]โ basically-Dbut you get to separate the groups with an empty line. METHOD can benone(that's the default),prepend, orseparate. โจ-f,--skip-fields=Nโ don't compare the first N fields. just skip right past them like they don't exist. ๐--group[=METHOD]โ shows you all the items, separating the groups with an empty line. METHOD isseparate(the default),prepend,append, orboth. ๐ธ-i,--ignore-caseโ ignores case differences when comparing. she's not gonna be weird about uppercase vs lowercase. ๐-s,--skip-chars=Nโ don't compare the first N characters. โ๏ธ-u,--uniqueโ only prints the unique lines. the ones that showed up exactly once. the rare ones. the special ones. ๐-z,--zero-terminatedโ the line delimiter isNUL, not newline. for when your data is built different. ๐ง-w,--check-chars=Nโ compares no more than N characters in each line. โจ--helpโ displays this help and exits. ๐ซถ--versionโ outputs version information and exits. โญ
๐ผ the field lore ๐ผ
a field is a run of blanks (usually spaces and/or TABs), then non-blank characters. and important: fields are skipped before chars. so the order matters, bestie. ๐
โ ๏ธ THE BIG WARNING, PAY ATTENTION:uniqdoes not detect repeated lines unless they are adjacent. like, she has no memory of what came before โ only what's right next to each other. so you may want to sort the input first, or just usesort -uwithoutuniqat all. ๐ this is THE thing people get wrong. don't be that person. i'm begging. ๐ญ
๐ AUTHOR ๐
written by Richard M. Stallman and David MacKenzie. legends. periodt. ๐ซถ
๐ REPORTING BUGS ๐
- report bugs to: <bug-coreutils@gnu.org>
- report any translation bugs to: <https://translationproject.org/team/>
- GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
- general help using GNU software: <https://www.gnu.org/gethelp/>
๐ COPYRIGHT ๐
Copyright ยฉ 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
this is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. (say it with me. no warranty. none. zero. ๐)
๐ SEE ALSO ๐
comm(1),join(1),sort(1)- full documentation <https://www.gnu.org/software/coreutils/uniq> or available locally via:
info '(coreutils) uniq invocation'
okay that's the whole page, you made it, i'm so proud of you ๐ฅน this was GNU coreutils 9.12, dated September 2026 โ and that's the tea, bestie. go sort your files and slay. ๐๐โจ
๐ฆ where this page comes from
- arch rolling: coreutils 9.12-2 ยท GPL-3.0-or-later AND GFDL-1.3-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms