The Computer Oracle

How do I restart Linux (Ubuntu) from the command-line?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Romantic Lands Beckon

--

Chapters
00:00 How Do I Restart Linux (Ubuntu) From The Command-Line?
00:19 Accepted Answer Score 80
00:30 Answer 2 Score 1
00:42 Answer 3 Score 9
01:17 Answer 4 Score 0
01:29 Thank you

--

Full question
https://superuser.com/questions/81005/ho...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #ubuntu #commandline #reboot

#avk47



ACCEPTED ANSWER

Score 80


There's a few ways:

sudo reboot
sudo init 6
sudo shutdown -r now



ANSWER 2

Score 9


If you've got freedesktop-compliant session manager, you can use DBus to invoke restart from inside the X session. The command goes:

dbus-send --system --dest=org.freedesktop.Hal --type=method_call \
    --print-reply /org/freedesktop/Hal/devices/computer \
    org.freedesktop.Hal.Device.SystemPowerManagement.Reboot int32:0

(this is probably more than necessary; works for me). I use this in a shell script. You don't need to run this from root, but you need to run it from inside an X session (f.e. in a terminal). You can find more on this topic at https://wiki.ubuntu.com/DebuggingGNOMEPowerManager




ANSWER 3

Score 1


I found this page on computerhope.com:

The command is reboot. There is also halt, poweroff & shutdown.




ANSWER 4

Score 0


nothing wrong with any of the above, but you can also install gnome-do and enable the session management plugin, which lets you easily shutdown,reboot,suspend from gnome-do