The Computer Oracle

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

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles

--

Chapters
00:00 Question
00:29 Accepted answer (Score 80)
00:43 Answer 2 (Score 9)
01:21 Answer 3 (Score 2)
01:56 Answer 4 (Score 1)
02:15 Thank you

--

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

Question links:
[y problem with mouse-clicks being ignored in Ubuntu]: https://superuser.com/questions/81003/th...

--

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