Suspend, Hibernate, Shutdown, And Restart Your Linux System From The Command Line

Posted By Weston Ganger

Sometimes I find it handy to perform power actions from the command line or after running a script.

Its pretty simple

# to shutdown
sudo poweroff
# or 
sudo shutdown -h now 

# to restart
sudo reboot
# or
sudo shutdown -r now

sudo apt-get install pm-utils

# to suspend
sudo pm-suspend

# to hibernate
sudo pm-hibernate

# to suspend/hibernate hybrid
sudo pm-suspend-hybrid

There is also an alternative method to suspend but I find it less reliable

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

Related External Links:

Article Topic:Software Development - Linux

Date:August 01, 2015