Bandit 7 → 8: don't read the file, search it
First level where the file is too big to look at. The instinct from every level
so far — ls, then cat — actively backfires here, and that’s the lesson.
the goal
The password for the next level is stored in the file
data.txtnext to the wordmillionth.
the approach
ls
data.txt
cat data.txt is the reflex, and it’s the wrong move — the file explodes across
the terminal. It’s a huge two-column list: an English word, a tab, a random
string, line after line. Nothing readable, and your scrollback is gone with it.
The objective says exactly where the password is: on the line whose word is
millionth. So the job isn’t to read the file, it’s to pull one line out of it:
grep millionth data.txt
One line back, password in the second column.
the takeaway
grep <pattern> <file> is the answer to “it’s in there somewhere”. It reads
the file so you don’t have to and prints only the lines that match. Once a file
is bigger than a screen, cat stops being a way of looking at things and grep
takes over.
Related habit worth building at the same time: less data.txt instead of cat
when you don’t know how big something is. It pages through instead of flooding,
/ searches inside it, q quits. Cheap insurance.