Short: The Halt Command

Today’s article is intentionally short because we’re simply going to learn about the basics of the halt command. There won’t be much to this article, because there doesn’t need to be.

If you have a Linux system, you can access the halt command. The halt command is one of the commands used for power management but not one you’re likely to use. You’re more likely to run reboot or shutdown command.

Why the halt command? Well, it’s archaic these days. I really can’t think of all that many, or any really, reasons to use it. I’m told you can use this command for low-level maintenance but I’ve never been able to use that for anything.

The Halt Command:

Under the hood, when you issue the halt command, the operating system goes through a series of steps to ensure a clean shutdown. It stops all running processes, unmounts filesystems, and sends signals to devices and services to shut down gracefully. Once everything is properly shut down, it halts the CPU and powers off the system hardware.

If you check the man page (with man halt) you’ll see that it agrees with the above statement and is a tool for managing your power state.

halt, poweroff, reboot – Halt, power-off or reboot the machine

While there’s more to the command, we’ll just cover the basics. So, press CTRL + ALT + T and open your default terminal emulator.

Or not… You only want to run the halt command when you need the command. It will shut everything down and that’s not something you necessarily want to do while reading this article.

The syntax is quite simple:

This will halt all the processes and leave the computer running. To completely turn it off, you’ll need to use the power button.

You can also try this command:

Now the -p is handy. After halting the computer, it will initiate a shutdown.

Then, you might find this a bit handier…

If it’s not obvious, the --reboot flag will reboot the computer. This means you needn’t use the power button for anything. It should just halt the system and then initiate a reboot sequence.

Closure:

That’s all there is today. I told you, it’s a short article. We just covered the halt command and nothing more. This isn’t complicated enough for a full-length article but is still a command that deserves to be mentioned. So, it has been mentioned. The good news is that there might be a future article that refers to this article, so my time might not be wasted.

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.

A Quick Look At The Shutdown Command

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:

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 CTRL + ALT + T a terminal should pop up. If not, there’s a terminal in your application menu.

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:

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:

If you want to reboot, try this command:

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:

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:

If you want to halt the system immediately, run this command:

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:

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.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.