iT邦幫忙

0

Linux Shutdown Command Examples (Complete Guide)

  • 分享至 

  • xImage
  •  

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


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言