How to know if Drive is SSD or HDD through Terminal?
A very dirty solution ;-) : Enter system_profiler | grep "Media Type: SSD" in Terminal.app.

A more detailed approach is system_profiler SPSerialATADataType and you'll get all devices attached to your SATA interfaces with - beyond other informations - the Medium Type which may be Rotational or SSD.
By adding -xml &gt; ~/Desktop/MyReport.spx you will get a XML-file on your desktop which can be opened by System Information.app.