Or you could do it Apple's way. Apple made something in the installer called createinstallmedia which does it for you:
Your 8 GB USB drive should be called Untitled and formatted as Mac OS Extended (Journaled). The installer should be called Install OS X Mavericks.app and should be in your Applications folder.
After downloading Mavericks from the Mac App Store, run this in terminal and wait about 20 minutes:
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
You should see something like this:
Erasing Disk: 0%... 10%... 20%... 100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.
You can then boot up from the USB by holding down the option key, then install Mavericks from the USB.
Note that this will also install a recovery partition.