how to check laptop serial number in ubuntu

C++
sudo dmidecode -t system | grep Serial

Source

Also in C++: