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

​Hey, pal! Again I am here with my other article which focuses on showing you the power of the terminal. Today’s article focuses 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 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
sudo shutdown -h now
sudo halt
sudo init 0
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

​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
sudo init 6
sudo shutdown -r now
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.

shutdown -r +60 ( Command to schedule restart)
shutdown -r

​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
sudo pm-suspend
systemctl suspend

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

​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?


​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. 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


Mohd Sohail is a web developer and a Linux sysAdmin. He also loves to write how-to articles, applications reviews and loves to use new Linux distributions.

Articles: 863

Leave a Reply

Your email address will not be published. Required fields are marked *