{"id":3285,"date":"2018-04-16T20:24:00","date_gmt":"2018-04-16T16:24:00","guid":{"rendered":"https:\/\/www.howtoforge.com\/linux-shutdown-command\/"},"modified":"2018-04-16T20:24:00","modified_gmt":"2018-04-16T16:24:00","slug":"linux-shutdown-command-explained-with-examples","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/linux-shutdown-command-explained-with-examples\/","title":{"rendered":"Linux shutdown Command Explained with Examples"},"content":{"rendered":"<p>The Linux command line may be a bit hard to learn, but it&#8217;s worth it. Reason being, it&#8217;s so powerful that you can do almost everything with it that you can otherwise do using UI. At HowtoForge, we have already discussed a plethora of command line tools (that let you do different kind of operations), and here, in this tutorial, we will discuss a utility which you can use to shut your system down.<\/p>\n<p>The utility in question in <strong>shutdown<\/strong>. In this tutorial, we will discuss the basics of this tool using some easy to understand examples. But before we do that, it&#8217;s worth mentioning that all examples here have been tested on Ubuntu 16.04 LTS.<\/p>\n<h2 id=\"linux-shutdown-command\">Linux shutdown command<\/h2>\n<p>The shutdown command lets you power-off, halt, or reboot your system. Following is its syntax:<\/p>\n<p class=\"command\">shutdown [OPTIONS&#8230;] [TIME] [WALL&#8230;]<\/p>\n<p>And here&#8217;s how the man page describes it:<\/p>\n<pre readability=\"23\"> shutdown may be used to halt, power-off or reboot the machine.<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The first argument may be a time string (which is usually \"now\").<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Optionally, this may be followed by a wall message to be sent to all<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 logged-in users before going down.<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The time string may either be in the format \"hh:mm\" for hour\/minutes<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 specifying the time to execute the shutdown at, specified in 24h clock<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 format. Alternatively it may be in the syntax \"+m\" referring to the<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 specified number of minutes m from now.\u00a0 \"now\" is an alias for \"+0\",<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i.e. for triggering an immediate shutdown. If no time argument is<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 specified, \"+1\" is implied.<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Note that to specify a wall message you must specify a time argument,<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 too.<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 If the time argument is used, 5 minutes before the system goes down the<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/run\/nologin file is created to ensure that further logins shall not be<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 allowed.<\/p><\/pre>\n<p>Following are some Q&amp;A-styled examples that should give you a good idea on how the shutdown utility works:<\/p>\n<h2 id=\"q-how-to-use-shutdown\">Q1. How to use shutdown?<\/h2>\n<p>The basic usage is easy &#8211; all you have to do is to run the &#8216;shutdown&#8217; command.<\/p>\n<p class=\"command\">shutdown<\/p>\n<p>The default behavior of this tool is to power off the machine. Please note that if no time argument is specified, <em>+1<\/em> is implied, which means the power off process will be initiated in a minute from now. In case you want the system to power off immediately, you can use <em>now<\/em> or <em>+0<\/em>.<\/p>\n<p>In case you want to issue a wall message (to sent to all logged-in users before going down), you can do that in the following way:<\/p>\n<p class=\"command\">shutdown &#8216;YOUR MESSAGE HERE&#8217;<\/p>\n<h2 id=\"q-how-to-halt-machine-using-shutdown\">Q2. How to halt machine using shutdown?<\/h2>\n<p>This can be\u00a0achieved using the -H option.<\/p>\n<p class=\"command\">shutdown -H<\/p>\n<p>In case you aren&#8217;t aware, there&#8217;s a difference between halting and powering off a system. While the former involves stopping all CPUs, the latter also makes sure the main power is disconnected.<\/p>\n<h2 id=\"q-how-to-make-shutdown-poweroff-machine\">Q3. How to make shutdown power-off machine?<\/h2>\n<p>Although this is by default, you can still use the -P option to\u00a0explicitly specify that you want shutdown to power off the system.<\/p>\n<p class=\"command\">shutdown -P<\/p>\n<h2 id=\"q-how-to-reboot-using-shutdown\">Q4. How to reboot using shutdown?<\/h2>\n<p>For reboot, the option is -r.<\/p>\n<p class=\"command\">shutdown -r<\/p>\n<h2 id=\"q-how-to-make-shutdown-only-write-wall-message-or-viceversa\">Q5. How to make shutdown only write wall message, or vice-versa?<\/h2>\n<p>In case you just want shutdown to shoot wall messages, without performing a halt, power-off, or reboot, use the <strong>-k<\/strong> command line option.<\/p>\n<p class=\"command\">shutdown -k<\/p>\n<h2 id=\"q-how-to-cancel-a-pending-shutdown\">Q6. How to cancel a pending shutdown?<\/h2>\n<p>You can use shutdown to schedule a halt, power off, or reboot. For this, all you have to do is to pass the time at which you want the process to start. For example:<\/p>\n<p class=\"command\">shutdown -r 18:00<\/p>\n<p>However, in case you want to cancel a scheduled shutdown, you can do that as well. This can be done using the -c command line option.<\/p>\n<p class=\"command\">shutdown -c<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>As most of you&#8217;d agree, the shutdown command doesn&#8217;t have a steep learning curve. Most features\/options it offers are easy to understand and use. Here, in this tutorial, we have discussed the majority of options. After you&#8217;re done practicing these, you can learn more about the tool by heading <a href=\"https:\/\/linux.die.net\/man\/8\/shutdown\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Flinux-shutdown-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/04\/linux-shutdown-command-explained-with-examples.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-shutdown-command%2F&amp;text=Linux+shutdown+Command+Explained+with+Examples&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/04\/linux-shutdown-command-explained-with-examples-1.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/04\/linux-shutdown-command-explained-with-examples-2.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-shutdown-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/04\/linux-shutdown-command-explained-with-examples-3.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Linux command line may be a bit hard to learn, but it&#8217;s worth it. Reason being, it&#8217;s so powerful that you can do almost everything with it that you can otherwise do using UI. At HowtoForge, we have already discussed a plethora of command line tools (that let you do different kind of operations), [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-3285","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/3285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=3285"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/3285\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=3285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=3285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=3285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}