commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Prints the type of computer you have.
I think this should be used more in distros and other applications because it is so easy to get. This can also be asked by tutorials as an easy way to get your base hardware.
sudo dmidecode -s system-product-name
sudo smbios-sys-info-lite | sed -n 's/^Product Name: *\(.*\)/\1/p'
Works for most distributions, tested on Ubuntu, Fedora, CentOS, Gentoo, SUSE, RedHat.
Debian and Slackware: