热门标签 | 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重启网络命令实例



推荐阅读
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 前言--页数多了以后需要指定到某一页(只做了功能,样式没有细调)html ... [详细]
  • 深入解析Android自定义View面试题
    本文探讨了Android Launcher开发中自定义View的重要性,并通过一道经典的面试题,帮助开发者更好地理解自定义View的实现细节。文章不仅涵盖了基础知识,还提供了实际操作建议。 ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • 本文详细介绍如何使用Python进行配置文件的读写操作,涵盖常见的配置文件格式(如INI、JSON、TOML和YAML),并提供具体的代码示例。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 1.如何在运行状态查看源代码?查看函数的源代码,我们通常会使用IDE来完成。比如在PyCharm中,你可以Ctrl+鼠标点击进入函数的源代码。那如果没有IDE呢?当我们想使用一个函 ... [详细]
  • XNA 3.0 游戏编程:从 XML 文件加载数据
    本文介绍如何在 XNA 3.0 游戏项目中从 XML 文件加载数据。我们将探讨如何将 XML 数据序列化为二进制文件,并通过内容管道加载到游戏中。此外,还会涉及自定义类型读取器和写入器的实现。 ... [详细]
  • 本文探讨了如何在给定整数N的情况下,找到两个不同的整数a和b,使得它们的和最大,并且满足特定的数学条件。 ... [详细]
  • 尽管使用TensorFlow和PyTorch等成熟框架可以显著降低实现递归神经网络(RNN)的门槛,但对于初学者来说,理解其底层原理至关重要。本文将引导您使用NumPy从头构建一个用于自然语言处理(NLP)的RNN模型。 ... [详细]
  • 本文详细介绍如何在VSCode中配置自定义代码片段,使其具备与IDEA相似的代码生成快捷键功能。通过具体的Java和HTML代码片段示例,展示配置步骤及效果。 ... [详细]
  • 探讨在循环中调用$.post()时,回调函数为何会在循环结束后才开始执行,并提供解决方案和优化建议。 ... [详细]
  • 深入解析 Spring Security 用户认证机制
    本文将详细介绍 Spring Security 中用户登录认证的核心流程,重点分析 AbstractAuthenticationProcessingFilter 和 AuthenticationManager 的工作原理。通过理解这些组件的实现,读者可以更好地掌握 Spring Security 的认证机制。 ... [详细]
  • 本文探讨了在 Vue 2.0 项目中使用 Axios 获取数据时可能出现的错误,并提供详细的解决方案和最佳实践。 ... [详细]
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社区 版权所有