uname
will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script.system_profiler SPHardwareDataType
is the data type that contains the core hardware information, and you can use grep or awk to pare things down further as needed: