linux系统管理——系统资源查看############# vmstat 命令 监控系统资源 #############vmstat [刷新时间 刷新次数][root@zabbix ~]# vmstat 1 3procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 3321084 2108 243580 0 0 23 43 124 159 1 2 97 0 0 0 0 0 3321084 2108 243580 0 0 0 115 181 230 0 2 98 0 0 0 0 0 3321084 2108 243580 0 0 0 4 163 251 1 0 99 0 0########### dmesg 开机时内核检测的信息 ################[root@zabbix ~]# dmesg [root@zabbix ~]# dmesg | grep CPU[ 0.000000] smpboot: Allowing 128 CPUs, 126 hotplug CPUs[ 0.000000] setup_percpu: NR_CPUS:5120 nr_cpumask_bits:128 nr_cpu_ids:128 nr_node_ids:1[ 0.000000] PERCPU: Embedded 38 pages/cpu @ffff9827f9600000 s118784 r8192 d28672 u262144[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=128, Nodes=1[ 0.000000] RCU restricting CPUs from NR_CPUS=5120 to nr_cpu_ids=128.[ 3.374277] mce: CPU supports 8 MCE banks[ 3.376148] MDS: Vulnerable: Clear CPU buffers attempted, no microcode[ 3.709685] smpboot: CPU0: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (fam: 06, model: 2a, stepping: 07)[ 3.710231] core: CPUID marked event: 'cpu cycles' unavailable[ 3.710237] core: CPUID marked event: 'instructions' unavailable[ 3.710243] core: CPUID marked event: 'bus cycles' unavailable[ 3.710247] core: CPUID marked event: 'cache references' unavailable[ 3.710252] core: CPUID marked event: 'cache misses' unavailable[ 3.710256] core: CPUID marked event: 'branch instructions' unavailable[ 3.710261] core: CPUID marked event: 'branch misses' unavailable[ 3.796324] smpboot: CPU 1 Converting physical 2 to logical package 1[ 3.796731] Brought up 2 CPUs[root@zabbix ~]# cat /proc/cpuinfo| grep "physical id" | sort| uniq| wc -l uniq 命令用于检查及删除文本文件中重复出现的行列,一般与 sort 命令结合使用[root@zabbix ~]# cat /proc/cpuinfo| grep "cpu cores"| uniq########### free 命令 #####################[root@zabbix ~]# free -h total used free shared buff/cache availableMem: 3.7G 287M 3.2G 12M 240M 3.1GSwap: 2.0G 0B 2.0G缓冲/缓存:缓存和缓存的区别:缓存(cache)是用来加速数据从硬盘中 ”读取“ 的,而缓冲(buffer)是用来加速数据 ”写入“ 硬盘的########### 查看系统与内核相关信息 #####################[root@zabbix ~]# uname -a 查看系统所有相关的信息 -r 查看内核版本 -s 查看内核名称 ########### 查询当前Linux系统的发行版本 ######[root@zabbix ~]# lsb_release -a-bash: lsb_release: 未找到命令[root@zabbix ~]# cat /etc/centos-releaseCentOS Linux release 7.6.1810 (Core)[root@zabbix ~]# cat /etc/issue\SKernel \r on an \m########## 判断当前系统的位数 ########[root@zabbix ~]# file /bin/ls/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=ceaf496f3aec08afced234f4f36330d3d13a657b, stripped########### 列出进程打开或使用的文件信息 ########[root@zabbix ~]# lsof#列出进程调用或打开的文件信息 -c 字符串: 只列出以字符串开头的进程打开文件 -u 用户名: 只列出某个用户的进程打开的文件 -p pid: 列出某个PID进程打开的文件