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) 
相关推荐
Rsingstarzengjx1 天前
第三十九章 Linux PWM 驱动实验
linux·运维·服务器
SeanQhl1 天前
BoostKit 环境准备
linux·openeuler·鲲鹏·boostkit·软件源
笔记本note1 天前
Linux 内存管理
linux·服务器·内存管理
郝学胜-神的一滴1 天前
Effective STL 条款 14:用扩容函数避免重新分配
linux·开发语言·网络·数据结构·c++·单片机
GeW1 天前
入行 Linux 与数据库运维:一条路径、三项习惯、一个考证观
linux·数据库
南子北游1 天前
Linux 进程状态全景(上)
linux·运维·服务器
无奈笑天下2 天前
银河麒麟高级服务器操作系统【配置 sudo 操作日志记录】操作方法
linux·运维·服务器
Android系统攻城狮2 天前
FFmpeg深度解析之av_codec_iterate:如何遍历音视频编解码器?(七十八)
linux·运维·ffmpeg·音视频·1024程序员节·音视频进阶
jipinxiaofeihua2 天前
(文章6) 03章-C++文件操作(下)
linux·运维·网络
饿了吃洗衣凝珠2 天前
shell
linux·运维·服务器