zoukankan      html  css  js  c++  java
  • 3. Linux常用系统状态检测命令

    1.ifconfig :于获取网卡配置与网络状态等信息,如网卡名称、IP、MAC等

       

    2.uname -a :完整地查看当前系统的内核名称、主机名、内核发行版本、节点名、系统时间、硬件名称、硬件平台、处理器类型以及操作系统名称等信息。

      举例:[root@Centos ~]# uname -a

      Linux Centos.com 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

      查看当前系统版本的详细信息:

      root@Centos ~]# cat /etc/centos-release

       CentOS Linux release 7.4.1708 (Core)

    3.uptime:查看系统的负载信息。
      [root@Centos ~]# uptime
      16:48:34 up 2 days, 23:45, 3 users, load average: 0.00, 0.01, 0.05
      uptime可以显示当前系统时间、系统已运行时间、启用终端数量以及平均负载值等信息。平均负载值指的是系统在最近1 分钟、5 分钟、15 分钟内的压力情况;负载值越低越好,尽量不要长期超过1,在生产环境中不要超过5。

    4.free -h:显示当前系统中内存的使用量信息。  

      举例:

      [root@Centos ~]# free -h
                 total  used   free  shared buff/cache available
      Mem: 1.8G  726M 464M 9.7M     632M         864M
      Swap: 2.0G 0B 2.0G

    5.who:查看当前登入主机的用户终端信息

      举例:

      [root@Centos ~]# who
      root :0 2020-08-01 01:42 (:0)
      root pts/0 2020-08-01 01:42 (:0)
      root pts/1 2020-08-03 16:18 (:0)

     三列分别表示:登录的用户名、终端设备、登录到系统的时间

    6.last:查看所有系统的登录记录,格式为“last [参数]”。

      使用 last 命令可以查看本机的登录记录。但是,由于这些信息都是以日志文件的形式保存在系统中,因此黑客可以很容易地对内容进行篡改。千万不要单纯以该命令的输出信息而判断系统有无被恶意入侵!

      

     7.history:显示历史执行过的命令。history -c 清空所有的命令历史记录。

      执行history 命令能显示出当前用户在本地计算机中执行过的最近1000 条命令记录。如果觉得1000 不够用,还可以自定义/etc/profile 文件中的HISTSIZE 变量值。
    还可以使用“!编码数字”的方式来重复执行某一次的命令。

       

      历史命令会被保存到用户hgme目录中的.bash_history 文件中。Linux 系统中以点(.)开头的文件均代表隐藏文件,这些文件大多数为系统服务文件。  

      [root@Centos ~]# cat /.bash_history

      exit
      passwd

    8.sosreport:收集系统配置及架构信息并输出诊断文档。

      当 Linux 系统出现故障需要联系技术支持人员时,大多数时候都要先使用sosreport命令来简单收集系统的运行状态和服务配置信息,以便让技术支持人员能够远程解决一些小问题,亦或让他们能提前了解某些复杂问题。在下面的输出信息中,加粗的部分是收集好的资料压缩文件以及校验码,将其发送给技术支持人员即可。可以用cat 命令查看其文件内容。  

      [root@Centos ~]# sosreport
      sosreport (version 3.0)
      This command will collect diagnostic and configuration information fromthis CentOS Enterprise Linux system and installed applications.
      An archive containing the collected information will be generated in/var/tmp and may be provided to a Red Hat support representative.Any information provided to Centos will be treated in accordance withthe published support policies at:https://access.redhat.com/support/
      The generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party.
      No changes will be made to system configuration.
      Press ENTER to continue, or CTRL-C to quit. 此处敲击回车来确认收集信息
      Please enter your first initial and last name [Centos.com]: 此处敲击回车来确认主机编号
      Please enter the case number that you are generating this report for: 此处敲击回车来确认主机编号

  • 相关阅读:
    vue单页应用项目加入百度统计代码
    关于VUE Spa 项目html5-History模式在微信浏览器内IOS和安卓分享的问题
    iphone 上使用contenteditable 输入法无法换行
    javaScript 三目运算符初探
    javaScript for in循环遍历对象
    javaScript 原型与原型链学习笔记
    javaScript call与apply学习笔记
    javaScript 对象学习笔记
    javaScript 立即执行函数学习笔记
    javaScript [[scope]]学习笔记
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/13427656.html
Copyright © 2011-2022 走看看