1. 查看系统版本
shell
[root@elwyn ~]# rpm -q centos-release
centos-release-7-6.1810.2.el7.centos.x86_64
2. 查看内核版本
shell
[root@elwyn ~]# uname -a
Linux elwyn 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
3. 查看系统CPU情况
shell
#查看物理CPU个数
[root@elwyn ~]# cat /proc/cpuinfo |grep "physical id" |sort|uniq|wc -l
1
#查看CPU是几核
[root@elwyn ~]# cat /proc/cpuinfo |grep "cores" |uniq
cpu cores : 1
#查看最大线程数(逻辑CPU的个数)
[root@elwyn ~]# cat /proc/cpuinfo |grep "processor" |wc -l
1
4. 查看磁盘空间
shell
[root@elwyn ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 7.4G 31G 20% /
devtmpfs 486M 0 486M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 448K 496M 1% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
tmpfs 100M 0 100M 0% /run/user/0
5. 查看内存使用情况
shell
[root@elwyn ~]# free -h
total used free shared buff/cache available
Mem: 991M 757M 68M 464K 165M 87M
Swap: 0B 0B 0B
6. 查看系统自启动服务
shell
[root@elwyn ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
aegis 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
#chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息。谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接。
shell
等级0表示:表示关机
等级1表示:单用户模式
等级2表示:无网络连接的多用户命令行模式
等级3表示:有网络连接的多用户命令行模式
等级4表示:不可用
等级5表示:带图形界面的多用户模式
等级6表示:重新启动
7. 查看系统的运行时长
shell
[root@elwyn ~]# uptime
09:16:43 up 18:20, 1 user, load average: 0.42, 1.95, 1.91
查看系统从何时运行的时间,最后一次重启的时间
shell
[root@elwyn ~]# cat /proc/uptime| awk -F. '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;
printf("系统已运行:%d天%d时%d分%d秒",run_days,run_hour,run_minute,run_second)}'
系统已运行:0天18时26分54秒
[root@elwyn ~]#
[root@elwyn ~]# last reboot |head -1
reboot system boot 3.10.0-957.21.3. Tue Mar 16 22:55 - 09:24 (10:28)