Levels from Level 5 to 9 focuses on basic techniques to find and sort things based on properties.
Level 5
This level requires us to find a file among files which is human readable, 1033 bytes in size and not executable. To do this we can use the find command.
$ find * -size 1033c
In the above command, we sort using only 1033 bytes file size. Explore the rest of options by reading the man pages!
$ man find
Level 6
This level is similar to the previous level, except here we sort on the basis of user, group and size.
$ find / -user bandit7 -group bandit6 -size 33c
Level 7
This level requires us to find the password by finding the word millionth in the file.
$ cat data.txt | grep "millionth"
Again, we use piping here. Where we take all the text and find the word millionth in the output which revals the password.
Level 8
This level requires us to find the line which occurs exactly only once. We could use the `uniq` command to find the line but there is one problem, uniq checks one word before and after the current word. So if the text is as follows:
apple
banana
orange
apple
banana
Then uniq wont be able to identify the uniqe lines. So we first sort the file and then pipe the sorted output to uniq.
$ sort data.txt | uniq -u
Why -u? Read the man pages!
Level 9
This level requires us to find a set of few human readable strings, preceeded by "=" characters. To accomplish this we would use the strings command which by default scans the file and returns any human-readble text string that is at least 4 characters long and end ends with a null or newline character.
$ strings data.txt | grep "==="