热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Linux重启网络命令实例及关机和重启示例教程

本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。
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重启网络命令实例



推荐阅读
  • 本文深入探讨了 Java 中的 Serializable 接口,解释了其实现机制、用途及注意事项,帮助开发者更好地理解和使用序列化功能。 ... [详细]
  • 在创建新的Android项目时,您可能会遇到aapt错误,提示无法打开libstdc++.so.6共享对象文件。本文将探讨该问题的原因及解决方案。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 1.如何在运行状态查看源代码?查看函数的源代码,我们通常会使用IDE来完成。比如在PyCharm中,你可以Ctrl+鼠标点击进入函数的源代码。那如果没有IDE呢?当我们想使用一个函 ... [详细]
  • CentOS7源码编译安装MySQL5.6
    2019独角兽企业重金招聘Python工程师标准一、先在cmake官网下个最新的cmake源码包cmake官网:https:www.cmake.org如此时最新 ... [详细]
  • 本文介绍了如何使用JQuery实现省市二级联动和表单验证。首先,通过change事件监听用户选择的省份,并动态加载对应的城市列表。其次,详细讲解了使用Validation插件进行表单验证的方法,包括内置规则、自定义规则及实时验证功能。 ... [详细]
  • 前言--页数多了以后需要指定到某一页(只做了功能,样式没有细调)html ... [详细]
  • XNA 3.0 游戏编程:从 XML 文件加载数据
    本文介绍如何在 XNA 3.0 游戏项目中从 XML 文件加载数据。我们将探讨如何将 XML 数据序列化为二进制文件,并通过内容管道加载到游戏中。此外,还会涉及自定义类型读取器和写入器的实现。 ... [详细]
  • 本文详细分析了Hive在启动过程中遇到的权限拒绝错误,并提供了多种解决方案,包括调整文件权限、用户组设置以及环境变量配置等。 ... [详细]
  • MySQL 数据库迁移指南:从本地到远程及磁盘间迁移
    本文详细介绍了如何在不同场景下进行 MySQL 数据库的迁移,包括从一个硬盘迁移到另一个硬盘、从一台计算机迁移到另一台计算机,以及解决迁移过程中可能遇到的问题。 ... [详细]
  • Composer Registry Manager:PHP的源切换管理工具
    本文介绍了一个用于Composer的源切换管理工具——Composer Registry Manager。该项目旨在简化Composer包源的管理和切换,避免与常见的CRM系统混淆,并提供了详细的安装和使用指南。 ... [详细]
  • 在Python开发过程中,随着项目数量的增加,不同项目依赖于不同版本的库,容易引发依赖冲突。为了避免这些问题,并保持开发环境的整洁,可以使用Virtualenv和Virtualenvwrapper来创建和管理多个隔离的Python虚拟环境。 ... [详细]
  • 本文介绍Linux中的Diff命令,该命令用于逐行对比两个文本文件,展示它们之间的差异。通过系统性检查,它能有效标识出文件间所有不同的行,无需事先对文件进行排序。 ... [详细]
  • 中科院学位论文排版指南
    随着毕业季的到来,许多即将毕业的学生开始撰写学位论文。本文介绍了使用LaTeX排版学位论文的方法,特别是针对中国科学院大学研究生学位论文撰写规范指导意见的最新要求。LaTeX以其精确的控制和美观的排版效果成为许多学者的首选。 ... [详细]
author-avatar
彼岸花芬芳
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有