How can I shut down or reboot Ubuntu using terminal commands?
For shutdown:
sudo poweroff
For restart:
sudo reboot
Appendix: If your keyboard is “locked up”, so you can’t enter a command like “reboot” which would run from “su” anyway, use the keyboard: hold down Alt + PrintScreen/SysRq, buttons and type “REISUB”. It doesn’t have to be capital letters. It will restart your computer gently.
sudo
might not be needed, actually.
– Nicolas RaoulOct 20, 2016 at 9:28
On Armbian, just reboot
is not found. instead, /sbin/reboot
works.
–
@MarkJeronimus It depends on your PATH
variable, and your SECURE_PATH
in the /etc/sudoers
file.
–
what about shutdown now
and shutdown -r now
?
– Post SelfJan 8, 2018 at 15:55
@NicolasRaoul nopes, for me i see this without sudo
. Failed to set wall message, ignoring: Interactive authentication required. Failed to reboot system via logind: Interactive authentication required. Failed to open /dev/initctl: Permission denied Failed to talk to init daemon.
– Paramvir Singh KarwalJul 15, 2019 at 17:30
Open your terminal with CTRL+ALT+T and do these following commands
To shutdown the system:
sudo shutdown -h now
To restart:
sudo reboot
& one more command for restart:
sudo shutdown -r now
Another way as one of the user mentioned.
For shutdown:
sudo halt
or:
sudo init 0
For restart:
sudo init 6
You can get more info on the shutdown
command by using one of the following:
shutdown --help
man shutdown
Improve this answerFollow
30.1k1717 gold badges108108 silver badges164164 bronze badges
answered Sep 12, 2012 at 18:09
102k106106 gold badges255255 silver badges328328 bronze badges
- 2It seems
shutdown -r now
is preferable toreboot
as the second can put you into maintenance mode – ubiquibacon May 11, 2014 at 11:44 - 2FYI What is the difference between the shutdown, halt and reboot commands? – Franck Dernoncourt Mar 8, 2017 at 20:52
- Can anyone explain why
sudo halt
might not perform shutdown in some cases, whereassudo halt -p
does? – Hee Jin Apr 11, 2018 at 23:48
Hate passwords (sudo
) and love one-liners?
For Ubuntu 15.04 and later
This is due to Ubuntu’s shift in using systemd
instead of Upstart
systemctl poweroff
systemctl reboot
systemctl suspend
systemctl hibernate
systemctl hybrid-sleep
Since hibernate is normally disabled by default in Ubuntu systems, you can enable this by checking this answer.
For Ubuntu 14.10 or earlier
Shutdown:
/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
Restart:
/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
Other commands you may like:
Suspend:
/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
Hibernate: (if enabled on your system)
/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
Improve this answerFollow
15.4k44 gold badges7979 silver badges120120 bronze badges
source : https://askubuntu.com/questions/187071/how-do-i-shut-down-or-reboot-from-a-terminal