linux command to find serial number of Lenovo laptop

Problem

You would like to find out the serial number of your Lenovo laptop, but without switching it off and taking the battery off.

Solution

You can run the following to get your laptop’s details including the serial number:

sudo dmidecode -t system

Taken from the post here