- 查看系统资源
vmstat -刷新秒数 -刷新次数:查看系统资源gmesg或gmesg | grep CPU:查看系统内核检测信息free:查看内存资源cat /proc/cpuinfo:查看 CPU 信息uptime:显示系统的启动时间和平均负载uname:查看系统与内核相关信息file /bin/ls:使用 file 查看系统命令的方式查看系统位数lsb_release -a:查看系统发行版本lsof | more:查看系统中所有进程调用的文件lsof /sbin/init:查询某个文件被哪个进程调用lsof -c php:查询某个进程调用了哪些文件lsof -u root:按照用户名查询用户调用了哪些文件
查看系统资源
vmstat -刷新秒数 -刷新次数:查看系统资源
[root@iZwz91sneajs2ji49vo4wxZ iep-test.ca163.com]# vmstat 1 3procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----r b swpd free buff cache si so bi bo in cs us sy id wa st1 0 0 547804 200756 2988016 0 0 16 41 28 3 1 1 98 0 00 0 0 547968 200756 2988048 0 0 0 0 1055 1875 1 0 99 0 00 0 0 546216 200756 2988196 0 0 180 4 1410 2166 3 1 96 0 0
gmesg 或 gmesg | grep CPU:查看系统内核检测信息
[root@iZwz91sneajs2ji49vo4wxZ ~]# dmesg | grep CPU[ 0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs[ 0.000000] setup_percpu: NR_CPUS:5120 nr_cpumask_bits:2 nr_cpu_ids:2 nr_node_ids:1[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1[ 0.000000] RCU restricting CPUs from NR_CPUS=5120 to nr_cpu_ids=2.[ 0.096380] TAA: Vulnerable: Clear CPU buffers attempted, no microcode[ 0.096381] MDS: Vulnerable: Clear CPU buffers attempted, no microcode[ 0.149758] smpboot: CPU0: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz (fam: 06, model: 55, stepping: 07)[ 0.250901] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.[ 0.253747] MDS CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html for more details.[ 0.253748] TAA CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html for more details.[ 0.253749] Brought up 2 CPUs[356373.065138] CPU: 0 PID: 1393 Comm: php-fpm Not tainted 3.10.0-1127.19.1.el7.x86_64 #1[356447.086440] CPU: 1 PID: 3686 Comm: RuoyiScheduler_ Not tainted 3.10.0-1127.19.1.el7.x86_64 #1
free:查看内存资源
-b:以 B 为单位显示-k:以 KB 为单位显示,默认值-m:以 MB 为单位显示-g:以 GB 为单位显示
[root@iZwz91sneajs2ji49vo4wxZ ~]# freetotal used free shared buff/cache availableMem: 7862344 6562544 161052 51916 1138748 969428Swap: 0 0 0[root@iZwz91sneajs2ji49vo4wxZ ~]# free -gtotal used free shared buff/cache availableMem: 7 6 0 0 1 0Swap: 0 0 0[root@iZwz91sneajs2ji49vo4wxZ ~]# free -mtotal used free shared buff/cache availableMem: 7678 6407 156 50 1114 948Swap: 0 0 0
cat /proc/cpuinfo:查看 CPU 信息
[root@iZwz91sneajs2ji49vo4wxZ ~]# cat /proc/cpuinfoprocessor : 0vendor_id : GenuineIntelcpu family : 6model : 85model name : Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHzstepping : 7microcode : 0x1cpu MHz : 2500.000cache size : 36608 KBphysical id : 0siblings : 2core id : 0cpu cores : 1apicid : 0initial apicid : 0fpu : yes...
uptime:显示系统的启动时间和平均负载
与 top 命令的第一行信息一样
[root@iZwz91sneajs2ji49vo4wxZ ~]# uptime09:32:08 up 19 days, 21:36, 1 user, load average: 1.05, 1.07, 1.09
uname:查看系统与内核相关信息
[root@iZwz91sneajs2ji49vo4wxZ ~]# unameLinux[root@iZwz91sneajs2ji49vo4wxZ ~]# uname -aLinux iZwz91sneajs2ji49vo4wxZ 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux[root@iZwz91sneajs2ji49vo4wxZ ~]# uname -r3.10.0-1127.19.1.el7.x86_64[root@iZwz91sneajs2ji49vo4wxZ ~]# uname -sLinux
file /bin/ls:使用 file 查看系统命令的方式查看系统位数
[root@iZwz91sneajs2ji49vo4wxZ ~]# 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]=aaf05615b6c91d3cbb076af81aeff531c5d7dfd9, stripped
lsb_release -a:查看系统发行版本
[root@iZwz91sneajs2ji49vo4wxZ ~]# lsb_release -aLSB Version: :core-4.1-amd64:core-4.1-noarchDistributor ID: CentOSDescription: CentOS Linux release 7.8.2003 (Core)Release: 7.8.2003Codename: Core
lsof | more:查看系统中所有进程调用的文件
[root@iZwz91sneajs2ji49vo4wxZ ~]# lsof | moreCOMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAMEsystemd 1 root cwd DIR 253,1 4096 2 /systemd 1 root rtd DIR 253,1 4096 2 /systemd 1 root txt REG 253,1 1628544 269422 /usr/lib/systemd/systemdsystemd 1 root mem REG 253,1 20064 272678 /usr/lib64/libuuid.so.1.3.0systemd 1 root mem REG 253,1 265576 266442 /usr/lib64/libblkid.so.1.1.0systemd 1 root mem REG 253,1 90248 265763 /usr/lib64/libz.so.1.2.7systemd 1 root mem REG 253,1 157424 266444 /usr/lib64/liblzma.so.5.2.2systemd 1 root mem REG 253,1 23968 266498 /usr/lib64/libcap-ng.so.0.0.0systemd 1 root mem REG 253,1 19896 265924 /usr/lib64/libattr.so.1.1.0systemd 1 root mem REG 253,1 19248 272662 /usr/lib64/libdl-2.17.sosystemd 1 root mem REG 253,1 402384 265943 /usr/lib64/libpcre.so.1.2.0
lsof /sbin/init:查询某个文件被哪个进程调用
[root@iZwz91sneajs2ji49vo4wxZ ~]# lsof /sbin/initCOMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEsystemd 1 root txt REG 253,1 1628544 269422 /usr/sbin/../lib/systemd/systemd
lsof -c php:查询某个进程调用了哪些文件
[root@iZwz91sneajs2ji49vo4wxZ ~]# lsof -c php | moreCOMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEphp 1804 root cwd DIR 253,1 4096 4595866 /www/wwwroot/education-new-serve/publicphp 1804 root rtd DIR 253,1 4096 2 /php 1804 root txt REG 253,1 10836280 3419670 /www/server/php/72/bin/phpphp 1804 root DEL REG 0,4 43760275 /dev/zerophp 1804 root DEL REG 0,4 34266732 /dev/zerophp 1804 root DEL REG 0,4 34267215 /dev/zerophp 1804 root DEL REG 0,4 34267214 /dev/zerophp 1804 root DEL REG 0,4 34267212 /dev/zerophp 1804 root mem REG 253,1 5527040 3417061 /www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/fileinfo.sophp 1804 root mem REG 253,1 402384 265943 /usr/lib64/libpcre.so.1.2.0php 1804 root mem REG 253,1 155744 265960 /usr/lib64/libselinux.so.1
lsof -u root:按照用户名查询用户调用了哪些文件
[root@iZwz91sneajs2ji49vo4wxZ ~]# lsof -u root | moreCOMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEsystemd 1 root cwd DIR 253,1 4096 2 /systemd 1 root rtd DIR 253,1 4096 2 /systemd 1 root txt REG 253,1 1628544 269422 /usr/lib/systemd/systemdsystemd 1 root mem REG 253,1 20064 272678 /usr/lib64/libuuid.so.1.3.0systemd 1 root mem REG 253,1 265576 266442 /usr/lib64/libblkid.so.1.1.0systemd 1 root mem REG 253,1 90248 265763 /usr/lib64/libz.so.1.2.7systemd 1 root mem REG 253,1 157424 266444 /usr/lib64/liblzma.so.5.2.2systemd 1 root mem REG 253,1 23968 266498 /usr/lib64/libcap-ng.so.0.0.0systemd 1 root mem REG 253,1 19896 265924 /usr/lib64/libattr.so.1.1.0systemd 1 root mem REG 253,1 19248 272662 /usr/lib64/libdl-2.17.sosystemd 1 root mem REG 253,1 402384 265943 /usr/lib64/libpcre.so.1.2.0systemd 1 root mem REG 253,1 2156240 265442 /usr/lib64/libc-2.17.sosystemd 1 root mem REG 253,1 142144 265469 /usr/lib64/libpthread-2.17.so
