If you have Onyx, which you should b/c it's a must have for Mac, you can just use it to change between the 3D and 2D dock. It only takes a checkbox, so why use Terminal if you don't need to? Onyx has other great features and controls that make it the best freeware for Macs.