Andrew Mercer
on this page

dmidecode decodes the SMBIOS/DMI tables the firmware exposes: system model and serial number, BIOS version, populated memory slots, and more. Needs root.

sudo dmidecode -t system                 # vendor, model, serial
sudo dmidecode -t bios
sudo dmidecode -t baseboard
sudo dmidecode -t processor
sudo dmidecode -t memory                 # every slot: size, speed, type, manufacturer, part number
sudo dmidecode -s system-serial-number   # single strings

Maximum supported memory and memory type

Type 16 is the "Physical Memory Array" record, describing the memory controller's capabilities:

sudo dmidecode -t 16                                        # max capacity, number of slots, ECC type
sudo dmidecode -t 16 | grep "Maximum Capacity"              # e.g. Maximum Capacity: 128 GB
sudo dmidecode -t memory | grep -E 'Size|Type:|Speed|Locator'   # what is installed (DDR4, 3200 MT/s ...)

Number Of Devices in type 16 is the count of slots. Type 17 (-t memory includes it) lists each slot. Firmware tables can be wrong or generic (especially in VMs), so confirm upgrade limits against the vendor's documentation. Related: lshw.