0

What should I type to safely shutdown a Linux computer from terminal?


My circumstance is:
I'm using "Raspberry Pi Zero W" over VNC (and SSH). I was able to shutdown it by GUI, but now I press the "Shutdown" button and nothing happens.
The "Raspberry Pi Configuration" app doesn't work neither, but it is not a big problem for me since "sudo raspi-config" works fine. I love the terminal :)
(The OS is "Raspbian Stretch", but I'd prefer a universal way if possible, since I also use other Linux-based OSes. That's why I'm posting this question here instead of Raspberry Pi Stack Exchange.)

2
  • 1
    I use shutdown -h now. This certainly works on Debian-based systems, but I don't know how universal it is.
    – AFH
    Commented Jan 16, 2018 at 21:21
  • Your answer works on most Linux distributions, Mac OSX, and Raspberry Pi. It is necessary to be root while executing it. Commented Jan 16, 2018 at 22:25

1 Answer 1

0

Using sudo reboot and sudo poweroff will reboot and shut down most Debian flavors.

You can also use sudo shutdown -h now to shut down the device and sudo shutdown -r now to reboot the device.

All this can be done through CLI.

1
  • Both sudo poweroff and sudo shutdown -h now worked fine on Lubuntu 16.04.1, Linux Mint 18.3 and Raspbian Stretch. Thanks!
    – user24346
    Commented Jan 17, 2018 at 20:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .