How To Shutdown Linux System?


I am new to Linux and I have installed some Linux distributions. I try to learn bash commands. I can shutdown my computer from Desktop manager easily. But How can I shutdown system from bash without a GUI. There are different ways to shutdown Linux system. Following commands will work most of the distributions like Ubuntu, Debian, Mint, Kali, CentOS, RedHat, Fedora.

Poweroff Command

We can shutdown a Linux system with poweroff command.  If we want to force the shutdown we can use -f parameter.

$ sudo poweroff

Reboot After Shutdown with Poweroff Command

poweroff command provides the --reboot option which will start the Linux system after a shutdown.

$ sudo poweroff --reboot

Halt

halt command change system run level by using systems service manager like systemd or service.

$ sudo halt

Reboot Command

reboot command actually a synonym of the poweroff command with --reboot option. We can use--halt option in order to halt and do not restart the system like below.

$ sudo reboot --halt
  • To shutdown system –halt parameter should be provided.

Shutdown Command

The most popular and well known command is shutdown command. This command automatically shutdown the current system.

$ sudo shutdown

Shutdown System After Given Time

We can set timer to shutdown system. In this example we will shutdown the system after 5 minutes the command issued.

$ sudo shutdown -h +5

Send Message To The System Users Before Shutdown

We can send message to the system users with shutdown command. This is useful is we give some time and send message to provide this information to the system users. In this example we will send the message System will be shutdown after 5 minutes

$ sudo shutdown -h +5 "System will be shutdown after 5 minutes"

 

LEARN MORE  How To Use "shutdown r" Command In Windows To Reboot and Shutdown Computer?

How To Shutdown Linux System Infografic

How To Shutdown Linux System Infografic
How To Shutdown Linux System Infografic

Leave a Comment