Skip to content

Linux Primer

Objective

Sugarplum Mary challenges you to complete the Linux Primer. You'll be asked to perform a task on the Linux command line. Enter the correct command to move on to the next task.

Solution

Perform a directory listing of your home directory to find a munchkin and retrieve a lollipop!

$ ls

Now find the munchkin inside the munchkin.

$ cat munchkin

Great, now remove the munchkin in your home directory.

$ rm munchkin_19315479765589239

Print the present working directory using a command.

$ pwd

Good job but it looks like another munchkin hid itself in you home directory. Find the hidden munchkin!

$ ls -a

Excellent, now find the munchkin in your command history.

$ history | grep munchkin

Find the munchkin in your environment variables.

$ env | grep munchkin

Next, head into the workshop.

$ cd workshop

A munchkin is hiding in one of the workshop toolboxes. Use "grep" while ignoring case to find which toolbox the munchkin is in.

$ grep -i munchkin *

A munchkin is blocking the lollipop_engine from starting. Run the lollipop_engine binary to retrieve this munchkin.

$ chmod a+x lollipop_engine; ./lollipop_engine

Munchkins have blown the fuses in /home/elf/workshop/electrical. cd into electrical and rename blown_fuse0 to fuse0.

$ cd electrical/; mv blown_fuse0 fuse0

Now, make a symbolic link (symlink) named fuse1 that points to fuse0

$ ln -s fuse0 fuse1

Make a copy of fuse1 named fuse2.

$ cp fuse1 fuse2

We need to make sure munchkins don't come back. Add the characters "MUNCHKIN_REPELLENT" into the file fuse2.

$ echo MUNCHKIN_REPELLENT >> fuse2

Find the munchkin somewhere in /opt/munchkin_den.

$ find /opt/munchkin_den -iname munchkin*

Find the file somewhere in /opt/munchkin_den that is owned by the user munchkin.

$ find . -user munchkin

Find the file created by munchkins that is greater than 108 kilobytes and less than 110 kilobytes located somewhere in /opt/munchkin_den.

$ find . -size +108k -size -110k

List running processes to find another munchkin.

$ ps -ef

The 14516_munchkin process is listening on a tcp port. Use a command to have the only listening port display to the screen.

$ netstat -ntl

The service listening on port 54321 is an HTTP server. Interact with this server to retrieve the last munchkin.

$ curl http://127.0.0.1:54321

Your final task is to stop the 14516_munchkin process to collect the remaining lollipops.

$ pkill 14516_munchkin