If you ever need to enter console commands without logging all the way into the desktop, Macworld has an old tip that shows you how to get access to the Terminal without going through the whole login process.
All you need to do is type
>console into the username field of the login screen, and you’ll get dumped into a Terminal screen. Here, you can run pretty much any commands you need without logging all the way into the desktop. You still need a login and password to do anything, but it’s a nice way to get quick access to your computer. This should work in pretty much all modern versions of OS X.