Question: What command can I use to retrieve the system's serial number from the unix command line? As `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.

Answer: 
This also works…

```
ioreg -l | grep IOPlatformSerialNumber

```
If you don't want to count columns you can rely on the fact that the value is always in the last one and use

```sh
system_profiler SPHardwareDataType | awk '/Serial/{print $NF}'

```