This is going to be just a quick article about a command many of you will be familiar with, as we take a quick look at the shutdown command. This is pretty basic and something everyone should be familiar with.
Our pure-GUI users will just shut the computer down with the menu option but sometimes a GUI is unresponsive. There are other times when you don’t have GUI access, as there’s no desktop environment loaded. When this happens, you can still shut the computer down. To do this, you can use the shutdown command.
There’s not a lot to the shutdown command, but the good news is that you won’t have to install anything to use it. If you’ve got a Linux system, you’ve got access to the shutdown command.
In fact…
shutdown:
As I said, you won’t need to install anything to use the shutdown command. It’s something that’s built in. You can check the man page with the following terminal prompt:
1 | man shutdown |
If you run that command, you’ll see that this is the correct tool for the job. It will in fact shut down the computer, though it has a few options that we’ll cover. We won’t cover everything, just the things you’re likely to need.
The man page describes the command like so:
shutdown – Halt, power-off or reboot the machine
See? If you want to shut the computer down (including halt and reboot) then this is the correct command for the job.
The Shutdown Command:
As mentioned above, this is a terminal-based command. That means you’re going to need an open terminal. If you press
Some systems may require ‘sudo‘ for this. This is not true for all distros and you’ll need to discover that on your own. I’ll omit the sudo in this article.
The basic syntax is this:
1 | shutdown |
That command will stop anyone from logging in and shut the computer down in five minutes. It’s the basic usage of the shutdown command.
If you want to shut down the computer immediately, try this command:
1 | shutdown now |
If you want to reboot, try this command:
1 | shutdown -r |
Again, that will reboot the computer in five minutes and stop anyone from logging into the system.
If you want to reboot immediately, add ‘now’ to the command like so:
1 | shutdown -r now |
You can also halt the system. If you halt the system, it will remain powered on but all CPU functions will cease immediately. That works just like the above commands. To halt the system in five minutes run this command:
1 | shutdown -h |
If you want to halt the system immediately, run this command:
1 | shutdown -h now |
You’ll need to power the system down and back on with the power button.
You can also schedule a shutdown, reboot, or halt. To do that, you use the HH:MM (hours/minutes in 24-hour time), like so:
1 2 3 | shutdown HH:MM shutdown -r HH:MM shutdown -h HH:MM |
If you schedule a shutdown, nobody will be able to log in within five minutes of the scheduled shutdown command. You’ll remain logged in and people can log in until that time is reached, but after that time is reached no new users can log into the system.
There is more to the shutdown command but that’s all you’ll realistically need, even as a system administrator. And, if you don’t know this already, you’re a system administrator even if you’re just a basic Linux desktop user. You’re in control of your computer.
Closure:
I thought I’d cover the shutdown command because it’s something I haven’t covered yet. I started off trying to cover the basics first, but I didn’t cover everything. There are still basic functions that I’ve yet to cover. I’ll get to them eventually.
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.