how to safely power off raspberry pi code example
Example 1: turn of raspberry
# in raspberry shell type:
sudo shutdown now
Example 2: how to shutdown raspbian command
#poweroff
sudo poweroff
#reboot
sudo reboot
# in raspberry shell type:
sudo shutdown now
#poweroff
sudo poweroff
#reboot
sudo reboot