How To: Shutdown Linux From The Terminal

Today’s article is going to tell you how to shutdown from the terminal. I’ve previously explained how to reboot a ‘frozen’ Linux system using the Magic SysReq keys. Today, we’ll shutdown from the terminal. It’s a quick and easy article – as the holidays are eating a bit of my “free” time.

Why would you want to do this? Well, if your Linux system isn’t quite frozen or your desktop GUI isn’t something you can reach, then you may want to press something like CTRL + ALT + F3. That should crack open a TTY where you can login and issue commands to your system. Maybe you’re working on a server and need to shut it down? Who knows, but the command is there and it’s a useful command to keep in mind.

For this article, we’ll mostly be using the shutdown command, and the man page defines it as:

shutdown – Halt, power-off or reboot the machine

And it does pretty much what you’d expect from such a command. However, it’s not just a basic command, there are flags and some options that go along with it. So, we might as well take the time to learn about it. After all, you never know when you want to shutdown Linux from the terminal.

Shutdown Linux From The Terminal:

Like oh so many articles, this one will require an open terminal. If you’re connected to a remote server via SSH, you already have a terminal to work with. If not, just press CTRL + ALT + T and your default terminal should open.

Once you’re ready to shutdown your Linux system, you can enter the following to shutdown immediately:

Obviously, that command will shutdown the system immediately, so don’t practice it unless you plan on shutting down – ’cause you will. You can even shutdown at a specific time by using this format (and 24h time):

You can also use the +MM function. To shutdown in 10 minutes, you’d use a command like this:

If you change that +10 to +0, it will also shutdown immediately. If you have users of the system who should be notified of an impending shutdown, then you can actually send them a message. That would look like:

So, what happens if you schedule a shutdown and need to stop it for some reason? Fortunately, the shutdown command will let you cancel an impending shutdown – so long as you get there in time. That’s done with the -c flag, of course.

If your cancellation will impact the users, you can even include a message in that. It’s done like this:

And that’s about it, really. There’s a bit more to the shutdown command, but it’s mostly going to be used in one of the ways mentioned in this article. If you want more information about the shutdown command, simply run man shutdown and read the help file.

Closure:

And there’s another article. This one will tell you how to shutdown Linux from the terminal, a handy skill to have as a user or as an admin. It may seem like a pretty basic command, but that doesn’t mean it can’t be included on the site. 

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe to Newsletter!
Get notified when new articles are published!
We promise to never share your email!
icon

Author: KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

2 thoughts on “How To: Shutdown Linux From The Terminal”

  1. I like the article. The one thing you might consider is contrasting “init 6” to reboot. From my understanding this might be a more graceful way to restart a system.

    1. I’ll have to look into that. If you’ve got a handy link or two, that’d be awesome. If not, I’ll try looking into it this coming week.

      I’m a bit sluggish today. I’m pretty sure I’m coming down with something. Yay for congregating for the holidays!

Leave a Reply

Your email address will not be published. Required fields are marked *

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.