Shut down the system

To bring your Linux system down in a secure way and prevent users from logging in during the process, you can use the shutdown command. You need to specify a time argument, like in this example:

linux shutdown now command

The runlevel 1 is the default, so the command above will put the system into the single-user mode. You can change the default behavior by specifying the extra parameters: -r reboots the system, -H halts it, and -P powers it off. For example, to reboot the system, use the -r option:

linux shutdown command reboot

You can specify the time for the shutdown. You can specify the time in the 24-hour clock format (for example, 14:30 for 2:30 p.m.). You can also specify the number of minutes to wait before the shutdown by using the +m format (for example, +5 to shutdown the system in 5 minutes). Here is an example:

linux shutdown specify minutes

To warn users about the impending shutdown, you can add a message to the end of the command:

linux shutdown user message

Each user on the system will receive the message about the shutdown:

linux shutdown warning

To cancel a shutdown, use the -c option:

linux cancel shutdown

Geek University 2022