Hey, pal! Again I am here with my another 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 shutdown -h now
sudo init 0
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 don’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 init 6
sudo shutdown -r now
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)
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 same just some words or key changes, that’s all. You can easily remember all commands.
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 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
Submit your topic