Shutting down the Linux systems can be done in different ways. We can use provided GUI like KDE, GNOME, Unity ect. to shutdown system. But what will we do if we have only console access to the system. We can use shutdown command to shutdown and reboot system.
We can use shutdown command without providing any option or parameter to simply shutdown the system. We need required privileges like root to shutdown a linux system.
Sometimes we need more time before shutting down the system. We can provide some interval before the shutdown command take effect with the time value
有时我们需要更多时间才能关闭系统。 我们可以在关闭命令生效之前提供一些时间间隔
In this example we will shutdown the system after 5 minutes now.
在此示例中,我们将在5分钟后关闭系统。
$shutdown -h 5 重启系统 (Restart System)
We can restart the Linux system with shutdown command. This will first shutdown system and then restart. We should provide -r option which means restart.
We can also restart the system at specified time. We will use -r option again by adding the interval value we want to wait. In this example we want to restart the system after 10 minutes.
$ shutdown -r 10 重新启动时跳过文件系统检查(fsck) (Skip File System Check (fsck) at Reboot)
Linux operating systems generally check a file system at start if there is some problems. This file system check may take some time. We can skip this file system check with -f option.
$ shutdown -r -f 向系统用户发送消息 (Send Message To System Users)
Linux operating system is designed to work multi user. At given time there may be more than one user connected to the Linux system. Shutting down will interrupt their connection and work too. We can send some message with shutdown command. As stated in syntax the message it the last part of the shutdown command.
In this example we will send message This system will shutdown in 5 minutes
在此示例中,我们将发送消息This system will shutdown in 5 minutes
$shutdown 5 "This system will shutdown in 5 minutes" 重启系统 (Reboot System)
We have alternative command to reboot the Linux system. We can simply use reboot command for this.
我们有替代命令来重新引导Linux系统。 我们可以简单地使用reboot命令。
$ reboot 重启权限 (Permissions For Reboot)
In Linux system root is the highest privileged administrator account. In order to reboot or shutdown we need root privileges. If we try to reboot without this privileges we will get errors like following.