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
bandit7@bandit:~$ ls
data.txt
bandit7@bandit:~$ cat data.txt
That was a mistake. The file exploded across the terminal — it’s a huge two-column list, an English word, then a tab, then a random string, for line after line after line. Nothing to read, and now my scrollback is gone too.
The objective tells you 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.
I asked an AI how to do that and got pointed at grep:
bandit7@bandit:~$ 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 against doing what I just did.