You can install this command line tool from [github.com/jmstacey/screenbrightness][1]. The install is pretty easy if you have homebrew:

    brew install screenbrightness

And usage is straightforward:

 - Set 100% brightness: ```screenbrightness 1```
 - Set 50% brightness:
   ```screenbrightness 0.5```

Unfortunately it doesn't work for external monitors. See http://apple.stackexchange.com/questions/61045/does-apple-support-ddc-ci-for-3rd-party-displays-via-apples-thunderbolt-to-dvi for background on why.


  [1]: https://github.com/jmstacey/screenbrightness