linux重启网络命令实例_Linux关机和重启示例教程

linux重启网络命令实例

linux重启网络命令实例

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.

关闭Linux系统可以通过不同的方式完成。 我们可以使用KDE,GNOME,Unity等提供的GUI。 关闭系统。 但是,如果我们只有控制台访问系统,我们将怎么办。 我们可以使用shutdown命令关闭并重启系统。

句法 (Syntax)

shutdown [OPTIONS...] [TIME] [MESSAGE...]

关机系统 (Shutdown 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.

我们可以使用shutdown命令,而无需提供任何选项或参数来简单地关闭系统。 我们需要像root这样的必需特权才能关闭linux系统。

$ shutdown

在指定时间关机 (Shutdown At Specified Time)

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.

我们可以使用shutdown命令重新启动Linux系统。 这将首先关闭系统,然后重新启动。 我们应该提供-r选项,这意味着重新启动。

$shutdown -r

在指定时间重启 (Restart At Specified Time)

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.

我们也可以在指定时间重新启动系统。 我们将通过添加要等待的间隔值来再次使用-r选项。 在此示例中,我们要在10分钟后重新启动系统。

$ 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.

Linux操作系统通常在启动时会检查文件系统是否存在问题。 此文件系统检查可能需要一些时间。 我们可以使用-f选项跳过此文件系统检查。

$ 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.

Linux操作系统旨在用于多用户。 在给定的时间,可能有多个用户连接到Linux系统。 关机将中断他们的连接并正常工作。 我们可以使用shutdown命令发送一些消息。 如语法中所述,消息是关闭命令的最后一部分。

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.

在Linux系统中, root是特权最高的管理员帐户。 为了重新引导或关闭,我们需要root特权。 如果我们尝试在没有此特权的情况下重新启动,则会收到类似以下的错误。

  • Failed to set wall message, ignoring: Interactive authentication required.

    无法设置墙消息,忽略:需要交互式身份验证。
  • Failed to reboot system via logind: Interactive authentication required.

    无法通过登录重新启动系统:需要交互式身份验证。
  • Failed to open /dev/initctl: Permission denied

    无法打开/ dev / initctl:权限被拒绝
  • Failed to talk to init daemon.

    无法与init守护进程对话。
LEARN MORE  Get-Service Service Management With Windows Powershell From Command Line
通过命令行了解更多有关Windows Powershell的Get-Service服务管理的信息
Permissions For Reboot
Permissions For Reboot
重启权限

So we have provide root privileges with the sudo command like below.

因此,我们通过sudo命令提供了root特权,如下所示。

$ sudo reboot
 

翻译自: https://www.poftut.com/linux-shutdown-reboot-command-tutorial-examples/

linux重启网络命令实例

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值