系统状态检测命令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]“。

 内存总量已用量可用量进程共享的内存量磁盘缓冲的内存量缓存的内存量
 totalusedfreesharedbufferscached
Mem:1.8G1.3G542MB9.8MB1.6MB413MB
-/+buffers/cache 869MB957MB   
Swap2.0GB02.0GB   

5.who命令

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

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

登录的用户名终端设备登录到系统的时间
rootpts/02019-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.

转载于:https://www.cnblogs.com/DevonL/p/11139279.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值