{"id":15823,"date":"2019-03-05T09:51:23","date_gmt":"2019-03-05T09:51:23","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15823"},"modified":"2026-03-09T19:19:43","modified_gmt":"2026-03-09T19:19:43","slug":"linux-shutdown-command","status":"publish","type":"post","link":"\/ng\/tutorials\/linux-shutdown-command","title":{"rendered":"How to use the Linux shutdown command in Ubuntu and CentOS"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>The Linux <strong>shutdown<\/strong> command is used to <strong>power off, reboot, and schedule these tasks on Unix-based systems<\/strong>, offering a flexible way to manage system downtime.<\/p><p>You can use <strong>shutdown -h now<\/strong> to power off your machine immediately or <strong>shutdown -r now<\/strong> to reboot it. To schedule a shutdown, use an absolute time, like <strong>shutdown 22:30<\/strong>, or a relative time, such as <strong>shutdown +15<\/strong>.<\/p><p>Using the <strong>shutdown<\/strong> command is critical for system security. It provides a controlled way to apply crucial updates and security patches that require a reboot, all while warning logged-in users to prevent data loss.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-the-shutdown-command\"><strong>What is the shutdown command?<\/strong><\/h2><p>The <strong>shutdown<\/strong> command lets you <strong>safely power off, reboot, and halt your system by communicating with systemd to initiate a specific target, like poweroff.target or reboot.target<\/strong>.<\/p><p>This process properly terminates all running services and notifies logged-in users.<\/p><p>The basic syntax for the <strong>shutdown<\/strong> command is:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown [OPTION] [TIME] [MESSAGE]<\/pre><p>Here&rsquo;s a breakdown of its components:<\/p><ul class=\"wp-block-list\">\n<li><strong>OPTION<\/strong>. Specifies the action to take. Common options include <strong>-H<\/strong> to halt the machine, <strong>-P<\/strong> to power it off (the default), and <strong>-r<\/strong> to reboot.<\/li>\n\n\n\n<li><strong>TIME<\/strong>. Determines when the command will execute. You can use an absolute time in 24-hour format (<strong>hh:mm<\/strong>) or a relative time, such as <strong>+m<\/strong>, where <strong>m<\/strong> is the number of minutes from now. The keyword <strong>now<\/strong> is an alias for <strong>+0<\/strong> and executes the command immediately. If you don&rsquo;t specify a time, the command defaults to <strong>+1<\/strong>, scheduling the shutdown for one minute in the future.<\/li>\n\n\n\n<li><strong>MESSAGE<\/strong>. Broadcasts an optional message to all logged-in users, warning them about the impending shutdown. You must specify a time argument to send a message.<\/li>\n<\/ul><p>To prevent new logins as a shutdown approaches, the command creates the<strong> \/run\/nologin<\/strong> file five minutes before the system goes down, but only if a time argument is used.<\/p><h3 class=\"wp-block-heading\" id=\"h-how-to-use-the-shutdown-command-in-linux-ubuntu-and-centos\"><strong>How to use the shutdown command in Linux Ubuntu and CentOS<\/strong><\/h3><p>The <strong>shutdown<\/strong> command works similarly on both Ubuntu and CentOS. To run these commands on a virtual private server (VPS), you&rsquo;ll first need to connect to it via an SSH client like PuTTY. We have a tutorial that explains <a href=\"\/ng\/tutorials\/how-to-use-putty-ssh\">how to use PuTTY<\/a> to access your VPS.<\/p><p>To set a one-minute timer before shutting down your system, use the basic command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown<\/pre><p>To shut down your system immediately, use the <strong>now<\/strong> argument:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown now<\/pre><p>To schedule a shutdown for a specific time, use the <strong>hh:mm<\/strong> format. For example, to shut down at <strong>10:30 PM<\/strong>, you would use:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown 22:30<\/pre><p>To schedule a shutdown for a set number of minutes from now, use the <strong>+m<\/strong> format. The following command will shut down the system in <strong>15 minutes<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown +15<\/pre><p>Finally, to display a warning message for any logged-in users, add your message after the time argument. For instance:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown +15 \"The server is shutting down for maintenance in 15 minutes. Please save your work.\"<\/pre><h3 class=\"wp-block-heading\" id=\"h-how-to-restart-your-vps-using-the-shutdown-command-in-linux\"><strong>How to restart your VPS using the shutdown command in Linux<\/strong><\/h3><p>To restart your VPS, <strong>add the -r (reboot) option to the shutdown command<\/strong>. This schedules a reboot for one minute in the future, giving you time to save your work.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown -r<\/pre><p>To reboot immediately, combine the <strong>-r<\/strong> option with the <strong>now<\/strong> argument:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown -r now<\/pre><p>You can also schedule a reboot for a specific time or after a particular duration:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown -r 22:30<\/pre><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown -r +15<\/pre><p>To include a message with a planned reboot:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown -r +15 &ldquo;The server is rebooting in 15 minutes to apply updates.&rdquo;<\/pre><p>Here are a few other command options you should know:<\/p><ul class=\"wp-block-list\">\n<li><strong>-H (&ndash;halt)<\/strong>. Halts the machine after <a href=\"\/ng\/tutorials\/how-to-kill-a-process-in-linux\">killing processes<\/a> without powering it off.<\/li>\n\n\n\n<li><strong>-P (&ndash;poweroff)<\/strong>. Powers off the system completely, which is the default action. The lowercase <strong>-h<\/strong> is also an alias for <strong>&ndash;poweroff<\/strong>.<\/li>\n<\/ul><p>For example, to halt the system, use:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown -H<\/pre><h3 class=\"wp-block-heading\" id=\"h-how-to-cancel-a-scheduled-shutdown-command-in-linux\"><strong>How to cancel a scheduled shutdown command in Linux<\/strong><\/h3><p>To cancel a scheduled shutdown in Linux, <strong>use the shutdown -c (cancel) command<\/strong>. This will immediately stop your previously scheduled shutdown or reboot task.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">shutdown -c<\/pre><p>Please note that you can&rsquo;t use this command to cancel an immediate action initiated with <strong>+0<\/strong> or <strong>now<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-how-can-i-use-hostinger-s-kodee-assistant-to-shut-down-or-restart-my-vps\"><strong>How can I use Hostinger&rsquo;s Kodee assistant to shut down or restart my VPS?<\/strong><\/h3><p>For <a href=\"\/ng\/vps-hosting\">Hostinger VPS<\/a> users, you can use all the commands mentioned in this tutorial. However, there&rsquo;s an even simpler way to manage your server&rsquo;s power state.<\/p><p><strong>Kodee<\/strong>, our AI assistant, can handle these tasks for you with a simple instruction. Navigate to your VPS dashboard, click the <strong>Ask Kodee<\/strong> button, and type a prompt like &ldquo;Restart my VPS&rdquo; or &ldquo;Shut down my server.&rdquo;<\/p><p>Kodee will handle the execution for you, confirming when the action is complete. This simplifies server management by removing the need to use the command line.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1adb8c9451\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"986\" height=\"828\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/hpanel-vps-overview-kodee.png\/public\" alt=\"Using Kodee AI assistant to restart a VPS server.\" class=\"wp-image-135447\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/hpanel-vps-overview-kodee.png\/w=986,fit=scale-down 986w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/hpanel-vps-overview-kodee.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/hpanel-vps-overview-kodee.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/hpanel-vps-overview-kodee.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 986px) 100vw, 986px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ng\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/public\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-why-the-shutdown-command-is-important-for-security\"><strong>Why the shutdown command is important for security<\/strong><\/h2><p>The <strong>shutdown<\/strong> command is important for security because <strong>it enables controlled and safe shutdowns, preventing data loss and file system corruption<\/strong>. Many critical system updates, especially security patches, require a reboot to take full effect.<\/p><p>By using the <strong>shutdown -r<\/strong> command, administrators can schedule these restarts during low-traffic periods. This approach minimizes downtime while keeping the system&rsquo;s defenses up to date.<\/p><p>A controlled shutdown also sends warnings to logged-in users, helping prevent unexpected data loss and allowing all running services to close gracefully. This level of predictability is crucial for maintaining a stable and secure server environment.<\/p><p>Mastering the <strong>shutdown<\/strong> command is, therefore, a key part of <a href=\"\/ng\/tutorials\/vps-security\">improved VPS security<\/a>. When you apply updates correctly and handle reboots methodically, your system remains reliable and resilient against potential threats.<\/p><p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Linux shutdown command is used to power off, reboot, and schedule these tasks on Unix-based systems, offering a flexible way to manage system downtime. You can use shutdown -h now to power off your machine immediately or shutdown -r now to reboot it. To schedule a shutdown, use an absolute time, like shutdown 22:30, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/linux-shutdown-command\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":411,"featured_media":145131,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to use the Linux shutdown command (with examples)","rank_math_description":"Learn how to use the Linux shutdown command to safely power off, restart, and schedule shutdowns on your server, improving its security.","rank_math_focus_keyword":"linux shutdown command","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-15823","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/linux-shutdown-command","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/commande-shutdown-de-linux","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/comando-shutdown-linux","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/perintah-shutdown-linux","default":0},{"locale":"ja-JP","link":"https:\/\/www.hostinger.com\/jp\/tutorials\/linux-shutdown-command","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/linux-shutdown-command","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/linux-shutdown-command\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/linux-shutdown-command\/","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/comando-shutdown-linux","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/comando-shutdown-linux","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/comando-shutdown-linux","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/linux-shutdown-command","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/linux-shutdown-command","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/linux-shutdown-command","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/linux-shutdown-command","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/411"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=15823"}],"version-history":[{"count":38,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15823\/revisions"}],"predecessor-version":[{"id":145130,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15823\/revisions\/145130"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/145131"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=15823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=15823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=15823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}