• 系统状态检测命令2019-7-5


    1.ifconfig

    ifconfig命令用于获取网卡配置与网络状态等信息,格式为“ifconfig [网络设备] [参数]

    [root@study ~]# ifconfig
    eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 192.168.218.138 netmask 255.255.255.0 broadcast 192.168.218.255
    inet6 fe80::20c:29ff:feda:49b1 prefixlen 64 scopeid 0x20<link>
    ether 00:0c:29:da:49:b1 txqueuelen 1000 (Ethernet)
    RX packets 2694 bytes 248684 (242.8 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 1160 bytes 269777 (263.4 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 0 (Local Loopback)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    2.uname

    uname命令用于查看系统内核与系统版本等信息,格式为”uname [-a]“。

    [root@study ~]# uname -a
    Linux study 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

    如果查看当前系统版本的详细信息,则需要查看redhat-relase文件,其命令以及相应的结果如下:

    [root@study ~]# cat /etc/redhat-release
    CentOS Linux release 7.2.1511 (Core)

    3.uptime命令

    uptime用于查看系统的负载信息,格式为uptime。

    显示当前系统时间、系统已经运行时间、启用终端数量及平均负载值等信息。平均负载值指的是系统在最近1分钟、5分钟、15分钟内的压力情况;负载值越低越好,尽量不要长期超过1,在生产环境中不要超过5。

    [root@study ~]# uptime
    13:14:00 up 39 min, 1 user, load average: 0.00, 0.01, 0.05

    4.free命令

    free用于显示当前系统中内存的使用量信息,格式为”free [-h]“。

      内存总量 已用量 可用量 进程共享的内存量 磁盘缓冲的内存量 缓存的内存量
      total used free shared buffers cached
    Mem: 1.8G 1.3G 542MB 9.8MB 1.6MB 413MB
    -/+buffers/cache   869MB 957MB      
    Swap 2.0GB 0 2.0GB      

    5.who命令

    who用于查看当前登入主机的用户终端信息,格式为”who [参数]“。

    [root@study ~]# who
    root pts/0 2019-07-05 12:46 (192.168.218.1)

    登录的用户名 终端设备 登录到系统的时间
    root pts/0 2019-07-05 12:46(192.168.218.1)

    6.last命令

    last命令用于查看所有系统的登录记录,格式为”last [参数]“。

    [root@study ~]# last
    root pts/0 192.168.218.1 Fri Jul 5 12:46 still logged in
    reboot system boot 3.10.0-327.el7.x Fri Jul 5 12:34 - 13:29 (00:54)
    root pts/0 192.168.218.1 Fri Jul 5 05:01 - crash (07:33)
    reboot system boot 3.10.0-327.el7.x Fri Jul 5 05:00 - 13:29 (08:29)
    root pts/0 192.168.218.1 Thu Jul 4 17:53 - 21:38 (03:44)
    root pts/0 192.168.218.1 Thu Jul 4 17:50 - 17:52 (00:01)
    root tty1 Thu Jul 4 17:48 - 21:38 (03:50)
    reboot system boot 3.10.0-327.el7.x Thu Jul 4 17:46 - 21:39 (03:52)
    root pts/0 192.168.2.1 Sun Mar 24 20:06 - crash (101+21:40)
    root tty1 Sun Mar 24 19:53 - crash (101+21:53)
    reboot system boot 3.10.0-327.el7.x Sun Mar 24 19:53 - 21:39 (102+01:45)

    wtmp begins Sun Mar 24 19:53:04 2019

    7.history命令

    history命令用于显示历史执行过的命令,格式为”history [-c]"。

    执行history命令能显示出当前用户在本地计算机中执行过的最近1000条命令记录。如果觉得1000不够用,还可以自定义/etc/profile文件中的HISTSIZE变量值。history -c 参数清空所有的命令历史记录。

    [root@study ~]# history
    1 echo Purple Cloud Fairy
    2 hostname study
    3 vim /etc/hostname
    4 bash
    5 echo Purple Cloud Fairy
    6 echo $shell
    7 echo $SHELL
    8 date
    9 date "+%Y-%m-%d $H:%M:$S"
    10 date "+%Y-%m-%d %H:%M:%S"
    11 date -s "20190704 21:13:00"

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

    [root@study ~]# cat ~/.bash_history
    echo Purple Cloud Fairy
    hostname study
    vim /etc/hostname
    bash
    echo Purple Cloud Fairy
    echo $shell
    echo $SHELL
    date
    date "+%Y-%m-%d $H:%M:$S"
    date "+%Y-%m-%d %H:%M:%S"
    date -s "20190704 21:13:00"

    8.sosreport命令

    sosreport命令用于收集系统配置及架构信息并输出诊断文档,格式为sosreport

    [root@study ~]# sosreport

    sosreport (version 3.2)

    This command will collect diagnostic and configuration information from
    this CentOS Linux system and installed applications.

    An archive containing the collected information will be generated in
    /var/tmp and may be provided to a CentOS support representative.

    Any information provided to CentOS will be treated in accordance with
    the published support policies at:

    https://www.centos.org/

    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 [study]: 此处敲回车来确认主机编号
    Please enter the case id that you are generating this report for []:此处敲回车来确认主机编号

    Setting up archive ...
    Setting up plugins ...
    Running plugins. Please wait ...

    Running 74/74: yum...
    Creating compressed archive...

    Your sosreport has been generated and saved in:
    /var/tmp/sosreport-study-20190705134033.tar.xz

    The checksum is: eca6e24c9d4ce0dd1335cb2ab12881f0

    Please send this file to your support representative.

  • 相关阅读:
    Linux下基于PAM机制的USB Key的制作
    IP-route管理路由
    Linux下CPU主板监控工具lm_sensors
    两个网卡隔离方法
    关机后内存的数据是怎么丢失的呢?
    6.0 移动端页面布局
    CyberPlayer 使用教程
    5.10 HTML5 音频和视频
    让Ecshop网店系统用户自动登陆
    設定 Bootstrap/SASS/Bower/gulp (Windows平台)
  • 原文地址:https://www.cnblogs.com/DevonL/p/11139279.html
Copyright © 2020-2023  润新知