The serial number of your system can be easily found on the bottom of your laptop in most of the systems. However, if you are working with a remote server and need to collect its info things get a little complicated. But fear not, for there is
dmidecode to save your day.
From the man page:
dmidecode is a tool for dumping a computer's DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system's hardware components, as well as other useful pieces of informa‐ tion such as serial numbers and BIOS revision.(...)
So, give it a try and see what a plethora of information types you can see using a single command.
As for the serial number, issue:
$ sudo dmidecode -s system-serial-number
In my system:
$ sudo dmidecode -s system-serial-number [sudo] password for dbkreling: BR5D81F0N