> For the complete documentation index, see [llms.txt](https://v13vv.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v13vv.gitbook.io/blog/blogs/ctfs/bandit-overthewire/bandit-3-level-2-greater-than-3.md).

# Bandit 3 ( level 2->3 )

{% embed url="<https://overthewire.org/wargames/bandit/bandit3.html>" %}

### Level Goal <a href="#level-goal" id="level-goal"></a>

The password for the next level is stored in a file called **spaces in this filename** located in the home directory

### Commands you may need to solve this level <a href="#commands-you-may-need-to-solve-this-level" id="commands-you-may-need-to-solve-this-level"></a>

[ls](https://manpages.ubuntu.com/manpages/noble/man1/ls.1.html) , [cd](https://manpages.ubuntu.com/manpages/noble/man1/cd.1posix.html) , [cat](https://manpages.ubuntu.com/manpages/noble/man1/cat.1.html) , [file](https://manpages.ubuntu.com/manpages/noble/man1/file.1.html) , [du](https://manpages.ubuntu.com/manpages/noble/man1/du.1.html) , [find](https://manpages.ubuntu.com/manpages/noble/man1/find.1.html)

### Helpful Reading Material <a href="#helpful-reading-material" id="helpful-reading-material"></a>

* [Google Search for “spaces in filename”](https://www.google.com/search?q=spaces+in+filename)

### Solving

ssh into bandit2:

```
ssh -p 2220 bandit2@bandit.labs.overthewire.org
```

In this level we'll also be playing with a tricky file name.\
In this level, we have spaces (" ") in file name, as you'll see in the img1.

<figure><img src="https://2709089421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeYJYZBkmMR8RE96AFddn%2Fuploads%2Ff7v8qNmZpSITHNLDjEta%2Fimage.png?alt=media&amp;token=f8862b86-5d50-49b9-801a-0d1d2cee064d" alt=""><figcaption><p>img1</p></figcaption></figure>

Of course we can not cat it ordinary, the spaces in a file name makes the shell think that they're a different files as I'll show you in the img2.

<figure><img src="https://2709089421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeYJYZBkmMR8RE96AFddn%2Fuploads%2FolaGWHx2ebFf4b0AsOdN%2Fimage.png?alt=media&amp;token=d30e8fa1-6330-44b4-b617-ff5eb8621686" alt=""><figcaption><p>img2</p></figcaption></figure>

To solve this scenario, there are many ways.\
In this blog I'll be showing 2 ways of the solutions

#### 1.) Using ""

You can use "" to cover the whole file name, like:

```
cat "spaces in this filename"
```

<figure><img src="https://2709089421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeYJYZBkmMR8RE96AFddn%2Fuploads%2FOZEX2289R6TTxjIRbB05%2Fimage.png?alt=media&amp;token=92c6a999-1c68-4c73-888c-43ab9449f433" alt=""><figcaption><p>img3</p></figcaption></figure>

or,

#### 2.) Using TAB

Anytime you are writing the command, you can always press the tab button to let the shell helps you finish the command. In this case, I also used tab and it works !:

<figure><img src="https://2709089421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeYJYZBkmMR8RE96AFddn%2Fuploads%2FSur7jLIzZPF7AgWYVfev%2Fimage.png?alt=media&amp;token=8fa712bc-08ba-4452-9e4c-019bb26f00f8" alt=""><figcaption><p>img4</p></figcaption></figure>

<figure><img src="https://2709089421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeYJYZBkmMR8RE96AFddn%2Fuploads%2FOJClVXekPXEQaAtCb1DY%2Fimage.png?alt=media&amp;token=a0408592-1144-4a2f-a3b5-25027ca8f59d" alt=""><figcaption><p>img5</p></figcaption></figure>

In img4, I wrote the command to the 'spaces' and then I stop and pressed TAB, giving me the result in img5. It works fine.

Anyway, as you can see, we captured our flag.

```
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx
```
