{"id":23714,"date":"2024-01-25T10:35:30","date_gmt":"2024-01-25T10:35:30","guid":{"rendered":"https:\/\/linuxways.net\/?p=23714"},"modified":"2024-01-25T10:44:26","modified_gmt":"2024-01-25T10:44:26","slug":"use-shutdown-command-debian-12","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/use-shutdown-command-debian-12\/","title":{"rendered":"How to Use shutdown Command in Debian 12"},"content":{"rendered":"<p>If your device is not in use, you should turn it off to improve its performance. Restarting and shutting down your device is also a key task for troubleshooting and completing the installation processes. Linux&#8217;s system provides various commands such as <strong>reboot<\/strong>, <strong>poweroff<\/strong>, <strong>halt,<\/strong> and <strong>shutdown <\/strong>to restart and power off your Debian system. However, you must ensure that you shut down the system in the right way, as improper shutdown can damage your device and cause data loss.<\/p>\n<p>The <strong>shutdown <\/strong>command is a more convenient and secure way to halt or restart your device. It first stops all running services and applications on the system and then shuts down a device. It can reboot, power off, and halt the machine using multiple parameters. Before executing the shutdown command, ensure that your applications exit properly and all the work is saved.<\/p>\n<p>In this guide, we will discuss the <strong>shutdown<\/strong> command in Debian 12 and its uses in detail with examples.<\/p>\n<h2><strong>Quick Outline<\/strong><\/h2>\n<p><a href=\"#post-23714-6a53uy4t8go3\"><strong>What is shutdown Command in Debian 12<\/strong><\/a><\/p>\n<p><a href=\"#post-23714-1ywdywdhtq3h\"><strong>How to Use shutdown Command in Debian 12<\/strong><\/a><\/p>\n<p><a href=\"#post-23714-lbyaqztdyopm\"><strong>Conclusion<\/strong><\/a><\/p>\n<h2><a id=\"post-23714-6a53uy4t8go3\"><\/a><strong>What is shutdown Command in Debian 12<\/strong><\/h2>\n<p>It is important to ensure that your system is safely shut down and in Debian 12, you can use the<strong> shutdown <\/strong>command to power off the system immediately, or schedule a shutdown. To execute the <strong>shutdown <\/strong>command on Debian, you must have sudo privileges, or log in as a root user.<\/p>\n<p>To switch to the root user on <strong>Debian 12, <\/strong>use the below-given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">su<\/span> -<\/div><\/div>\n<p>Otherwise, use the sudo prefix while running the<strong> shutdown<\/strong> command in the terminal. The most basic command to shut down the system is written below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"152\" class=\"wp-image-23732\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-1.png 793w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-1-300x58.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-1-768x147.png 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><\/p>\n<p>Using the above command, your system will schedule a shutdown and within one minute it will be powered off automatically.<\/p>\n<p>You can customize the <strong>shutdown<\/strong> command using the various options. To view the available options that can be used with the<strong> shutdown<\/strong> command on Debian, execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"re5\">--help<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"404\" class=\"wp-image-23740\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-2.png 785w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-2-300x154.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-2-768x395.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/p>\n<h2><a id=\"post-23714-1ywdywdhtq3h\"><\/a><strong>How to Use shutdown Command in Debian 12<\/strong><\/h2>\n<p>You can use the <strong>shutdown command <\/strong>in Debian 12 to:<\/p>\n<ul>\n<li>Immediately Shut Down System<\/li>\n<li>Shut Down System After Specified Time<\/li>\n<li>Shut Down After Sending Message<\/li>\n<li>Restart System<\/li>\n<li>Cancel the Shut Down Process<\/li>\n<li>See Scheduled Shut Down<\/li>\n<li>View the Log of the Shut Down<\/li>\n<\/ul>\n<h3><strong>1: Immediately Shut Down System<\/strong><\/h3>\n<p>One minute is the default waiting time to power off the system; if you do not want to wait then use the <strong>shutdown<\/strong> command with <strong>now<\/strong> argument to immediately turn off the system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown now<\/div><\/div>\n<p>Moreover, you can provide the full path of the <strong>shutdown<\/strong> command to power off your Debian immediately:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>sbin<span class=\"sy0\">\/<\/span>shutdown now<\/div><\/div>\n<h3><strong>2: Shut Down System After Specified Time <\/strong><\/h3>\n<p>Use the time option with the <strong>shutdown<\/strong> command to power off the system after a specified time; it provides the users time to save their work. The basic syntax of using the time argument with the <strong>shutdown<\/strong> command is written below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"sy0\">&lt;<\/span><span class=\"kw1\">time<\/span><span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>The two mostly used formats of time are written below:<\/p>\n<ul>\n<li>+m (The system will be shutdown after specific minutes)<\/li>\n<li>hh:mm (Set the time according to the time zone)<\/li>\n<\/ul>\n<p>If you run the below command, the system will automatically shut down at 4:20 am:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown 04:<span class=\"nu0\">20<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"209\" class=\"wp-image-23743\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-3.png 783w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-3-300x80.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-3-768x205.png 768w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><\/p>\n<p><strong>Note: <\/strong>The <strong>date<\/strong> command is used to display the system\u2019s current time according to your time zone.<\/p>\n<p>Run the below command to <strong>shut down<\/strong> the Debian 12 after 3 minutes:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown +<span class=\"nu0\">3<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"769\" height=\"203\" class=\"wp-image-23749\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-4.png 769w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-4-300x79.png 300w\" sizes=\"auto, (max-width: 769px) 100vw, 769px\" \/><\/p>\n<h3><strong>3: Shut Down System After Sending Message <\/strong><\/h3>\n<p>If multiple users access your system, it is better to display a message to inform them about the shutdown. This can be done using the message argument along with the time while executing the <strong>shutdown <\/strong>command through the following basic syntax:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"sy0\">&lt;<\/span><span class=\"kw1\">time<\/span><span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">&lt;<\/span>message<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>For example, the below command will shut down the system after five minutes and once you execute this command, it will display the mentioned message on the screen of all users:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown +<span class=\"nu0\">5<\/span> \u201cSystem is going to shut down soon\u201d<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"749\" height=\"227\" class=\"wp-image-23754\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-5.png 749w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-5-300x91.png 300w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/p>\n<p>This will display a broadcast message to every logged-in user using the same terminal.<\/p>\n<h3><strong>4: Restart System<\/strong><\/h3>\n<p>You can also reboot your Debian system by executing the<strong> shutdown<\/strong> command with the &#8211;<strong>r <\/strong>flag. The following command will reboot the system after the default time, one minute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"re5\">-r<\/span><\/div><\/div>\n<p>To reboot the system immediately, use the <strong>now <\/strong>argument:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"re5\">-r<\/span> now<\/div><\/div>\n<p>To schedule a system reboot using the <strong>shutdown<\/strong> command on Debian, add the time argument. The below command will reboot the system after five minutes:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"re5\">-r<\/span> +<span class=\"nu0\">5<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"174\" class=\"wp-image-23759\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-6.png 724w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-6-300x72.png 300w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/p>\n<p>You can also schedule a system restart by displaying a message on the user\u2019s screen. The following command will reboot the system after five minutes by displaying the mentioned message:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown +<span class=\"nu0\">5<\/span> \u2013r \u201cThe system is going to restart\u201d<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"167\" class=\"wp-image-23763\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-7.png 731w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-7-300x69.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<h3><strong>5: Cancel the Shutdown Process<\/strong><\/h3>\n<p>To cancel the ongoing shutdown process, use the<strong> -c<\/strong> flag with the <strong>shutdown<\/strong> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"re5\">-c<\/span><\/div><\/div>\n<h3><strong>6: See Scheduled Shutdown<\/strong><\/h3>\n<p>If you want to view the scheduled shutdown on your Debian system, execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> shutdown <span class=\"re5\">--show<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"760\" height=\"172\" class=\"wp-image-23768\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-8.png 760w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-8-300x68.png 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/p>\n<h3><strong>7: View the Log of the shutdown<\/strong><\/h3>\n<p>The below command will show the log of all the shutdowns since the file was created on your Debian 12:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">last<\/span> shutdown<\/div><\/div>\n<p><strong>OR<\/strong><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">last<\/span> <span class=\"re5\">-x<\/span> shutdown<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"366\" class=\"wp-image-23777\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-9.png 714w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-23714-9-300x154.png 300w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/p>\n<h2><a id=\"post-23714-lbyaqztdyopm\"><\/a><strong>Conclusion<\/strong><\/h2>\n<p>Shutdown is a process that is carried out every day, and you must ensure that you properly shut down your system to avoid damaging the file system. You can shut down your system from the GUI or through the command line as well. If you want to shut down your Debian system through the terminal, the \u201c<strong>sudo shutdown\u201d <\/strong>command is a better option. Using the <strong>shutdown<\/strong> command, you can provide messages, schedule a shutdown, and cancel the shutdown at any time. You can also keep and view the shutdown record by executing the \u201c<strong>last shutdown<\/strong>\u201d command.<\/p>","protected":false},"excerpt":{"rendered":"<p>The shutdown command in Debian 12 is used to power off, halt, and restart the system. Learn more about the shutdown command in this command.<\/p>","protected":false},"author":115,"featured_media":23832,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-23714","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=23714"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23714\/revisions"}],"predecessor-version":[{"id":23827,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23714\/revisions\/23827"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/23832"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=23714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=23714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=23714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}