Recap of Last Lesson: We logged into the overthewire Bandit 1 after reading the file “readme” located in the /home/bandit0 directory.

Bandit Level 3


Find the password to the next level

Intel Given

  • Password is in a file named ‘spaces in this filename‘
  • file is located in the home directory

How to

This is simply a file name we need to read. The problem is we can’t just type ‘cat spaces in this filename’. This is because *nix interprets each space as a separate item.  We don’t currently have any variables, objects or commands named ‘spaces, in, this, filename’ so this command doesn’t make sense to our operating system. Which leads us into escape characters.

Escape Characters

Escape characters can get kind of tricky and drawn out, so I’ll give you the short and sweet of it. Escape characters tells the shell to do something OTHER than what it should do. In this shell if you want ‘cat spaces in this filename’ to have its spaces preserved so that ‘spaces in this filename’ is one ITEM then you need to tell it to do so. The backslash () is used to do this. So we type ‘cat spaces in this filename’ the escape character is always BEFORE the character you wish to escape. In another example if we wanted to remove all items in the current directory we would just type ‘rm *’ but if we typed ‘rm *’ it would remove all the files named *.

Tab Completion

So is typing each back slash kind of pain in the ass? Kind of, but *nix shells offer something amazing called tab completion. If you halfway type a command and hit tab, unix will attempt to complete it for you and the same goes with filenames. So I literally typed ‘cat sp’ and hit tab. My shell automatically filled in the rest for me.


Escape characters are powerful when programming and helpful when dealing with filenames that have funky characters in them. Additionally tab completion is extremely powerful and if used effectively can really increase the speed in which you traverse through file structures. Try using it with ‘cd’ to move around to different files within your OS.

Hackmethod is proud to announce Mal_Wear by HM. Exploit/Vulnerability themed nerdy t-shirts! Get them while they last. Dismiss