Because I own a number of Raspberry Pi systems, I get roughly the same question quite regularly about each one of them: how can I confirm what this Raspberry Pi model is from the command line? The reason I usually want to know is because the model of the Raspberry Pi hints the Raspbian release that will support it (older Raspbian releases do not have support for the most recent models of Raspberry Pi).
There's a few hardware specs like CPU speed and generation, and also a memory size – they used to be helpful in getting the question above answered.
But turns out there's an even better way: use the model file in the /proc/device-tree directory, like shown below:
$ cat /proc/device-tree/model Raspberry Pi 3 Model B Rev 1.2
On another server it returns this:
cat /proc/device-tree/model Raspberry Pi 2 Model B Rev 1.1
Once you confirm the hardware model, consult the Raspbian page on Wikipedia to see Raspbian versions supporting it.