Linux Shutdown Command Examples (Complete Guide)

国内高佣广告联盟 熊掌联运广告联盟 最新域名优惠/VPS优惠/免备案CDN活动

Do you know How to shutdown your Linux Operating System securely?

It’s straightforward.

In this guide, you will learn How to Shutdown Linux OS securely using the shutdown command.

Before starting the topic, I would like to explain to you the different shutdown process.

Types of Shutdown

There are two types of shutdown:

Hard Shutdown:

When we forcefully shutdown an operating system, it is called a hard shutdown.

This is not a recommended shutdown process, but sometimes circumstances arise that force us to perform a Hard Shutdown such as When the system hangs, Power Failure and So on.

But as much as possible we should avoid this option as This type of shutdowns can cause problems such as Operating System corruption or Hardware malfunctions.

Graceful Shutdown:

This is a recommended shutdown process.

Such practice causes the operating system to shutdown all services systematically. Gives information to users to save their data.

So there are many benefits of such type of shutdown.

Features of Linux Shutdown Command:

  • Halt
  • Shutdown
  • Reboot

Syntax:

You must follow the syntax given below to use the shutdown command.

shutdown [OPTIONS...] [TIME] [WALL...]

1. How to Shutdown your System

The superuser (root) or the users listed in the sudoers file can run the shutdown command.

So you always have to run this command with sudo.

Note: sudoers file is located at /etc/sudoers

To Shutdown your system type the following command.

~$ sudo shutdown
[sudo] password for ubuntu: 
Shutdown scheduled for Fri 2020-06-19 03:52:23 PDT, use 'shutdown -c' to cancel.

Without any argument by default, this command starts the shutdown process after an interval of 1 minute from now.

2. Shutdown the System Immediately

To shutdown the system immediately you have to pass now argument to shutdown command.

~$ sudo shutdown now

Also, you can run the following command to get the same result.

Note: “now” is an alias for “+0“

~$ sudo shutdown +0

3. Shutdown the System at Specified Time

You can schedule to Shutdown the system at specified time. You must specify the time in HH:MM (Hour:Minute) format.

shutdown command executes the scheduled task in a 24-hour time format.

Alternatively, you can use the +m as a syntax to shutdown the system after specified minutes.

Where “m” stands for Minutes.

Now let’s take some examples:

Ex # 1: Shutdown the system after 5 Minutes from now.

~$ sudo shutdown +5

Ex # 2: Shutdown the system after 1 Hour from now.

~$ sudo shutdown +60

Ex # 3: Shutdown the System at 07:30 AM.

~$ sudo shutdown 07:30

Ex # 4: Shutdown the machine at 07:30 PM.

~$ sudo shutdown 19:30

Read Complete Story Here

推荐:
Head Command Examples in Linux (The Complete Guide)

Linux has several commands that helps to display the contents of a file. such as: cat command nl com…

35 ls Command Examples in Linux (The Complete Guide)

Do you know how to list contents (files/directories) in Linux? It’s straightforward. In this article…

16 cat Command Examples in Linux (The Complete Guide)

Today I have brought a handy command for you, and that is the cat command. ‘cat‘ stands for “Concate…

Linux 联名T恤可还行?

Penton大佬: 获取路径: 1. 访问https://summit.aliyun.com/hol?utm_content=g_1000134119 2. 体验馆-《Linux命令入门》 3. 体验…

linux 网络防火墙

hekang大佬: 如题, 各位MJJ用的是什么防火墙呢?  精挑细选还是中意这三款。。      pfsense网络防火墙 OPNsens…