If you are connected via SSH or a console cable, you can pull the serial number directly from the system environment using these commands: