Linux基础命令_系统状态检测命令

Linux基础命令之系统状态检测命令

1. ifconfig命令

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

[root@centos7 ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        inet6 fe80::42:6fff:fe12:3983  prefixlen 64  scopeid 0x20<link>
        ether 02:42:6f:12:39:83  txqueuelen 0  (Ethernet)
        RX packets 24  bytes 1608 (1.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 648 (648.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.16.1.100  netmask 255.255.255.0  broadcast 172.16.1.255
        inet6 fe80::6730:d2dd:5a53:1f10  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:11:9d:ae  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 23  bytes 1698 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.100  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::24dd:6869:4691:a2a1  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:11:9d:a4  txqueuelen 1000  (Ethernet)
        RX packets 461835  bytes 666749161 (635.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 43901  bytes 5029892 (4.7 MiB)
        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 1  (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 -a。

 [root@centos7 ~]# uname -a
Linux centos7.xxx.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@centos7 ~]# cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)

3. uptime命令

用于查看系统的负载信息,格式为:uptime。
显示当前系统时间、系统已运行时间、启用终端数量以及平均负载值等信息。平均负载值指的是系统在最近1分钟、5分钟、15分钟内的压力情况。

[root@centos7 ~]# uptime
 01:18:31 up  5:56,  2 users,  load average: 0.00, 0.01, 0.05

4.free命令

用于显示当前系统中内存的使用量信息,格式为:free [参数]。

参数 -h

以人类可读单位显示内存使用量信息。

Buffer和Cache

https://www.zhihu.com/question/26190832

5.who命令

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

[root@centos7 ~]# who
root     tty1         2020-03-25 09:17
root     pts/0        2020-03-29 00:03 (10.0.0.1)

6.last命令

用于查看所有系统的登录记录,格式为:last [参数]。
该命令读取的文件默认为:/var/log/wtmp(记录成功登陆日志),/var/log/btmp(记录错误登陆日志)

7.history命令

history命令用于显示当前用户历史执行过的命令记录,默认为1000条,格式为:history。
该命令读取的文件是用户家目录中.bash_history

参数:-c

清空所有的命令历史记录

小技巧:

!记录对应的数字,可以重复执行该命令

[root@centos7 ~]# history
    1  free -h
    2  history
[root@centos7 ~]# !1
free -h
              total        used        free      shared  buff/cache   available
Mem:           976M        177M        238M         12M        560M        633M
Swap:          2.0G        252K        2.0G
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值