How can i get the mac family number using terminal? I want to get model number/family number.

http://www.everymac.com/systems/by_capability/mac-specs-by-model-number-family-number.html.

I have found the above link that have listed all the Model number. 

That information does not exist in the SystemProfiler.
Click the apple icon in the top left "About This Mac", admittedly not Terminal. Do you have any reason to do this in Terminal?