Command-Line Mystery

This notebook sets you up for running Noah Veltman's commandline mystery.

To check where we are, display the current working directory.

There are a several of ways we can do this, either using IPython magic:

In [38]:
%pwd
Out[38]:
'/vagrant/notebooks/tm351'

or a command line / shell command invocation:

In [39]:
!pwd
/vagrant/notebooks/tm351

Download the mystery

The mystery files are provided in a zip file that we can download from https://github.com/veltman/clmystery/archive/master.zip.

The %%bash block cell magic allows us to write several bash shell commands, that all execute wihting the same shell environment, in a single code cell:

In [11]:
%%bash
#Download (wget) the file from the specified URL quietly (-q)
wget -q https://github.com/veltman/clmystery/archive/master.zip

#Unzip the file very quietly (-qq)
unzip -qq master.zip

#Delete the downloaded zip file
rm master.zip

#Display the contents of the unzipped file directory
ls clmystery-master
cheatsheet.md
cheatsheet.pdf
encoded
hint1
hint2
hint3
hint4
hint5
hint6
hint7
hint8
instructions
LICENSE.md
mystery
README.md
solution

It probably makes sense to read the README.html

In [40]:
!cat clmystery-master/README.md
The Command Line Murders
========================

	.OOOOOOOOOOOOOOO @@                                   @@ OOOOOOOOOOOOOOOO.
	OOOOOOOOOOOOOOOO @@                                    @@ OOOOOOOOOOOOOOOO
	OOOOOOOOOO'''''' @@                                    @@ ```````OOOOOOOOO
	OOOOO'' [email protected]@@@@@@@@@@@@@@@@@@@"""                   """""""""@@aaaa `OOOO
	OOOOO,""""@@@@@@@@@@@@@@""""                                     [email protected]"" OOOA
	OOOOOOOOOoooooo,                                            |OOoooooOOOOOS
	OOOOOOOOOOOOOOOOo,                                          |OOOOOOOOOOOOC
	OOOOOOOOOOOOOOOOOO                                         ,|OOOOOOOOOOOOI
	OOOOOOOOOOOOOOOOOO @          THE                          |OOOOOOOOOOOOOI
	OOOOOOOOOOOOOOOOO'@           COMMAND                      OOOOOOOOOOOOOOb
	OOOOOOOOOOOOOOO'a'            LINE                         |OOOOOOOOOOOOOy
	OOOOOOOOOOOOOO''              MURDERS                      aa`OOOOOOOOOOOP
	OOOOOOOOOOOOOOb,..                                          `@aa``OOOOOOOh
	OOOOOOOOOOOOOOOOOOo                                           `@@@aa OOOOo
	OOOOOOOOOOOOOOOOOOO|                                             @@@ OOOOe
	[email protected]                               aaaaaaa       @@',OOOOn
	[email protected]                        [email protected]@@@@@@@""        @@ OOOOOi
	OOOOOOOOOO~~ aaaaaa"a                 [email protected]@@@@@@@@@""            @@ OOOOOx
	OOOOOO [email protected]"""""""" ""            @@@@@@@@@@@@""               @@@|`OOOO'
	OOOOOOOo`@@a                  [email protected]@  @@@@@@@""         [email protected]        @@@@ OOOO9
	OOOOOOO'  `@@a               @@[email protected]@   @@""           [email protected]@   a     |@@@ OOOO3
	`OOOO'       `@    [email protected]@       aaa"""          @a        [email protected]     [email protected]@@',OOOO'


There's been a murder in Terminal City, and TCPD needs your help.

To figure out whodunit, you need access to a command line.

Once you're ready, clone this repo, or [download it as a zip file](https://github.com/veltman/clmystery/archive/master.zip).

Open a Terminal, go to the location of the files, and start by reading the file 'instructions'.

One way you can do this is with the command:

	cat instructions

(`cat` is a command that will print the contents of the file called `instructions` for you to read.)

To get started on how to use the command line, open cheatsheet.md or cheatsheet.pdf (from the command line, you can type 'nano cheatsheet.md').

Don't use a text editor to view any files except these instructions, the cheatsheet, and hints.

### Credits

By Noah Veltman  
Projects: [noahveltman.com](http://noahveltman.com)  
GitHub: [veltman](https://github.com/veltman)  
Twitter: [@veltman](https://twitter.com/veltman)  

Just before you get started on solving the mystery, it's worth noting that each time we run a shell command using !, or use the %%bash magic, the commands are run in their own shell:

In [30]:
#Print (echo) the current directory (pwd)
!echo $(pwd)

#Change directory to the parent directory
# then (;) show the current directoy
!cd ..; echo $(pwd)

#Show the current directory
!echo $(pwd)
/vagrant/notebooks/tm351/clmystery-master/mystery
/vagrant/notebooks/tm351/clmystery-master
/vagrant/notebooks/tm351/clmystery-master/mystery

To "persistently" change the current directory, we need to change the directory used in the outer IPython environment from which the shell commands are run. We can do this using the %cd line magic:

In [33]:
%cd clmystery-master/mystery
!pwd
/vagrant/notebooks/tm351/clmystery-master/mystery
/vagrant/notebooks/tm351/clmystery-master/mystery

List the contents of the current directory...:

In [17]:
! ls
crimescene  interviews	memberships  people  streets  vehicles

The instructions suggest we need to start by looking at the crimescene report:

In [ ]:
!cat crimescene

There's rather a lot in there, but we're told the clues are marked as a CLUE. TO get you started, here's one way of filtering out those items — use the grep command to search for lines containing the word CLUE:

In [21]:
!grep CLUE crimescene
CLUE: Footage from an ATM security camera is blurry but shows that the perpetrator is a tall male, at least 6'.
CLUE: Found a wallet believed to belong to the killer: no ID, just loose change, and membership cards for AAA, Delta SkyMiles, the local library, and the Museum of Bash History. The cards are totally untraceable and have no name, for some reason.
CLUE: Questioned the barista at the local coffee shop. He said a woman left right before they heard the shots. The name on her latte was Annabel, she had blond spiky hair and a New Zealand accent.

Now get to it...