How to Safely Shutdown or Reboot Your Raspberry Pi

Title says it all, but there’s a bit more useful information too. Personally, I’ve always used “sudo halt”.