Linux系统查看常用命令

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) 
相关推荐
bush43 小时前
嵌入式linux学习记录七,中断
linux·嵌入式
RisunJan4 小时前
Linux命令-nologin(用于系统账户或需要禁止交互式登录的场景)
linux·运维
是阿建吖!4 小时前
【Linux】信号
android·linux·c语言·c++
城北徐宫4 小时前
Linux信号深度解剖:5种产生、3张表、4次切换
linux·c++·学习
倔强的石头1064 小时前
【Linux指南】Linux快捷键与系统实用技巧
linux·运维·服务器
番茄地瓜4 小时前
Linux 配置静态 IP 步骤
linux·运维·服务器
liulilittle4 小时前
论 Linux 内核态全局稳态带宽的卡尔曼估计与工程实现
linux·服务器·网络·c++·计算机网络·tcp·通信
Irissgwe5 小时前
五、应用层协议HTTP
linux·网络·网络协议·http·状态码·url
.千余5 小时前
【Linux】 传输层协议UDP:从端口号到传输机制
linux·运维·udp
囚~徒~6 小时前
轻量化的虚拟机
linux·运维·服务器