turn off raspberry pi command code example
Example 1: turn of raspberry
# in raspberry shell type:
sudo shutdown now
Example 2: raspi emergency shutwodn
sudo shutdown -now
If it doesn't work. Pull the plug (it could damage your SD card but desperate
times call for desperate measures)