Find server model and serial number in Linux/RHEL

Ever needed to know the exact model or serial number of a Linux machine but only have access to the command line?

# dmidecode | egrep -i "product name|serial number"
        Product Name: ProLiant DL360 G7
        Serial Number: USE000A11M
        Serial Number: USE000A11M
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: Not Specified
        Serial Number: 57QXF00000D9D1
        Serial Number: 57QXF00000D9B2

A lot of the individual hardware components have serial numbers (or, could have serial numbers), but the first two identical ones are the actual system serial number. On this particular machine the two serial numbers listed at the end seem to be for the power supplies.

Update – September 09, 2011 at 09:31:
Even better:

# dmidecode -t system
# dmidecode 2.9
SMBIOS 2.6 present.

Handle 0x0100, DMI type 1, 27 bytes
System Information
        Manufacturer: HP
        Product Name: ProLiant DL360 G7
        Version: Not Specified
        Serial Number: USE000A11M
        UUID: 30000000-3000-5000-4000-300000000000
        Wake-up Type: Power Switch
        SKU Number: 579237-B21
        Family: ProLiant

Handle 0x2000, DMI type 32, 11 bytes
System Boot Information
        Status: No errors detected