Linux Tutorials

Control PC Power Functions Via Terminal – Shutdown, Restart, Hibernate & Suspend

Control PC Power Functions Via Terminal Shutdown Restart Hibernate amp Suspend

​Hey, pal! Again I am here with my other article which again focuses on showing you the power of the terminal. Today’s article is focused on how you can control the power functions of PC i.e. Power Off, Hibernate, suspend and restart. The commands are really easy and you can easily remember them and use them as you need.  

There is no Terminal week or terminal special month going on if you are thinking so. Since the last month we have focused more on the terminal, published many terminal related articles, many are waiting in line. This is natural because Terminal is an essential tool of Linux distros.

Mutt An Open Source Text Based Email Client For Linux
Get Hardware Details In Linux With ‘dmidecode’
All About Tar Files And How To tar, untar Files In Linux Using Terminal

Let us start now.​

Commands To Power Off/Shutdown

​Here are the commands to shutdown. To turn off the PC, if it is Ubuntu or Debian based –

sudo poweroff
or
sudo shutdown -h now
or
sudo halt
or
sudo init 0
or
systemctl poweroff 

Use any one of them and system will power off.  Remember sudo isn’t required until you are on lock screen or some kind of tricky situation.​On any other distro. shutdown -h now ​Specify the time limit for shutdown like this one – shutdown -h +60

commands to poweroff or shutdown

  ​In case you are wondering “h” represents halt. Also, you can sudo commands in case you want but they require admin privilege but the last command doesn’t require that. When you schedule time, it is in minutes which means 60 represents 60 min=1 hour.  

Commands For Reboot

Here is how you can reboot your system from terminal –

sudo reboot
or
sudo init 6
or
sudo shutdown -r now
or
systemctl reboot

​You can use them on any Ubuntu/Debian based distro. Use only one at a time. Remember sudo isn’t required if you are logged in.Or you can use this command on any kind of Linux based distro.

reboot
or
shutdown -r +60 ( Command to schedule restart)
or
shutdown -r 
commands to reboot linux

​Even if you got this, “r” goes for a restart.  

Commands to Suspend/Hibernate

​Below is again the commands to either hibernate or so-called suspend. Interesting this is that if you have noticed that most commands are the same just some words or key changes, that’s all. You can easily remember all commands.

sudo pm-hibernate
or
sudo pm-suspend
or
systemctl suspend ​

Simple and elegant ways to do that. See most commands are also same here too.  

Recommended Discussions

​Some of the discussions on Ubuntu forums helped me a lot to find that whether some of the commands work on not. Do check them out. They also contain some more methods (more complicated) too.

How do I shutdown or reboot from a terminal?
How can I suspend hibrenate from command line?

Conclusion

​As you can see, the command line can do pretty much cool things. But personally, I will stick to my power key to just turn off my PC when needed. I am on Linux Mint 18.1. I can access what to do after pressing the power button, and also I am not always on a command line. But when I am, I always use. ​SUDO POWEROFF

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This website uses cookies to improve your experience. We'll assume you're ok with this. Thank you! Accept Read More