Linux will detects SSD automatically.
Since kernel version 2.6.29, you can check /dev/sda with following command
|  |  | 
The return number 0 shows you /dev/sda is a SSD, and 1 shows it is a HDD.
Note that this command may not work when your disk is created by hardware RAID.
Another way is to use lsblk command, a part of the util-linux package.
|  |  | 
ROTA means rotational device, 1 for true, 0 for false.
This command report the same information as in /sys/block/.../queue/rotational