OverTheWire Bandit Level 8 Writeup — Find the One Unique Line Among Duplicates

Misc 2026-10-01 · OverTheWire Bandit · By CTFdojo · ⏱ ... · 👁 ... views
𝕏 Share
TL;DR

The password is the one line in data.txt that occurs exactly once among thousands of duplicated lines — sort groups identical lines together, and uniq -u prints only the ones with no duplicate.

PlatformOverTheWire Bandit
CategoryLinux Fundamentals
Level8 → 9
DifficultyBeginner
Techniquesort + uniq -u

Challenge description

Level 8 hands you a file where almost every line of text shows up more than once. Somewhere in there is exactly one line that appears only a single time — that line is the password.

"Level Goal: The password for the next level is stored in the file data.txt and is the only line of text that occurs only once."

Step 1 — Understand why uniq alone won't work

uniq only collapses consecutive duplicate lines — it has no effect on a file where duplicates are scattered throughout rather than grouped together. The file needs to be sorted first so every copy of a given line ends up adjacent to its other copies.

Step 2 — Sort the file

Sorting brings every duplicate of a line next to each other, which is the precondition uniq needs to do anything useful:

sort data.txt | less
(every line now appears grouped with its exact duplicates)

Step 3 — Filter to lines with no duplicate

uniq's -u flag prints only the lines that have exactly one occurrence — exactly the property the level described:

sort data.txt | uniq -u
[PASSWORD FOR bandit9]
🔑 password intentionally hidden

The password is deliberately hidden — follow the method, you've earned it. 💪

Key takeaways

sort and uniq are almost always used together, because uniq only ever looks at immediately adjacent lines. "Find the duplicate" or "find the one that's NOT duplicated" in a scrambled file is a sort | uniq problem essentially every time.

Resources

CTFdojo
CTFdojo
Community of ethical hackers writing beginner-friendly CTF writeups and guides.

Got a question or a different approach?

Discuss this writeup with the community on the CTFdojo Discord.

Join the Discord →