详细的Linux服务器状态、性能相关命令

服务器
linux服务器状态、性能相关命令大家了解吗?小编为大家总结一下,希望能帮助迷茫中的你。

服务器状态分析

查看Linux服务器CPU详细情况

#查看CPU的信息

  1. [root@host ~]# cat /proc/cpuinfo  

#查看物理CPU的个数

  1. [root@host /]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 

#查看每个物理CPU的核数

  1. [root@host /]# cat /proc/cpuinfo | grep "cpu cores" | uniq 

#逻辑CPU的个数(逻辑CPU = 物理CPU个数*核数)

  1. [root@host /]# cat /proc/cpuinfo | grep "processor" | wc -l 

[[244655]]

查看Linux服务器内存情况

#查看内存使用情况

  1. [root@host ~]# free -m 
  2. total used free shared buffers cached 
  3. Mem: 372 256 115 0 17 158 
  4. -/+ buffers/cache: 81 290 
  5. Swap: 509 0 509 

>total:内存总数

>user:已使用内存数

>free:空闲内存数

>shared:多进程共享内存数

>buffers:缓冲内存数

>cached:缓存内存数

可用内存 = free+buffers+cached

已用内存 = used-buffers-cached

swap 交换内存数,此项可判断内存是否够用的标准

查看Linux服务器硬盘使用情况

#查看硬盘及分区信息

  1. fdisk -l 
  2.  
  3. [root@host ~]# fdisk -l 
  4. Disk /dev/sda: 10.7 GB, 10737418240 bytes 
  5. 255 heads, 63 sectors/track, 1305 cylinders 
  6. Units = cylinders of 16065 * 512 = 8225280 bytes 
  7. Device Boot Start End Blocks Id System 
  8. /dev/sda1 * 1 13 104391 83 Linux 
  9. /dev/sda2 14 78 522112+ 82 Linux swap / Solaris 
  10. /dev/sda3 79 1305 9855877+ 83 Linux 

#检查文件系统的磁盘空间占用情况

df -h

  1. [root@host ~]# df -h 
  2. Filesystem Size Used Avail Use% Mounted on 
  3. /dev/sda3 9.2G 6.4G 2.3G 74% / 
  4. /dev/sda1 99M 12M 82M 13% /boot 
  5. tmpfs 187M 0 187M 0% /dev/shm 
  6. /dev/hdc 4.1G 4.1G 0 100% /mnt 

服务器性能分析

#查看硬盘的I/O性能

  1. [root@host /]# iostat -d -x -k 1 5 
  2. #iostaat是含在套装systat中,在CentOs5.5用命令yum -y install sysstat来安装 

I/0

查看Linux服务器的平均负载

  1. [root@host /]# uptime 
  2. 12:39:12 up 2:50, 3 users, load average: 0.00, 0.03, 0.00 

  1. [root@host /]# w 
  2. 12:39:59 up 2:50, 3 users, load average: 0.00, 0.03, 0.00 
  3. USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT 
  4. root tty1 - 09:53 32:17 0.36s 0.36s -bash 
  5. root pts/0 192.168.1.102 10:23 1:54m 0.03s 0.03s -bash 
  6. root pts/1 192.168.1.105 12:16 0.00s 0.09s 0.02s w 

监控Linux服务器的整体性能

整体性能

  1. [root@host /]# vmstat 1 4 
  2. procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ 
  3. r b swpd free buff cache si so bi bo in cs us sy id wa st 
  4. 0 0 0 50464 50096 101356 0 0 21 13 925 183 0 0 99 1 0 
  5. 0 0 0 50464 50096 101380 0 0 0 0 830 18 0 0 100 0 0 
  6. 0 0 0 50464 50096 101380 0 0 0 0 833 27 0 0 100 0 0 
  7. 0 0 0 50464 50104 101372 0 0 0 32 822 27 0 0 99 1 0 

#proces r:等待运行的进程数 b:非中断睡眠状态的进程数 w:被交换出去的可运行进程数

#memory swpd:虚拟内存使用情况 fres:空闲的内存 buff:用作缓存的内存数(单位:KB)

#swap si:从磁盘交换到内存的交换页数量 so:从内存交换到磁盘的交换页数量(单位:kb/秒)

#io bi:发送到块设备的块数 bo:从块设备接收到的块数(单位:块/秒)

#system in:每秒的中断数,包括时钟中断 cs:每秒的环境(上下文)切换数

#cpu us:CPU使用时间 sy:CPU系统使用时间 id:闲置时间(单位:百分比)

标准情况下:r小于5,b约为0

如果user + sys 小于70 表示系统性能较好;如果大于等于85以上,表示性能比较糟糕

查看Linux服务器的其他参数

查看系统内核的版本号

  1. [root@host /]# uname -a 
  2. Linux host.domain.com 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux 
  3. [root@host /]# uname -r 
  4. 2.6.18-194.el5 

查看系统32位还是64位

  1. [root@host /]# ls -1F / |grep /$ 
  2. 查找是否有/lib64,有则系统为64位 
  3. 另一种查看系统32位还是64位 
  4. [root@host /]# file /sbin/init 
  5. /sbin/init: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped 

查看服务器使用的Linux发行版的相关信息

  1. [root@host /]# lsb_release -a 
  2. LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch 
  3. Distributor ID: CentOS 
  4. Description: CentOS release 5.5 (Final) 
  5. Release: 5.5 
  6. Codename: Final 

查看系统已载入的相关模块

  1. [root@host /]# lsmod |grep ip 
  2. ipv6 435361 24  
  3. xfrm_nalgo 43333 1 ipv6 
  4. dm_multipath 56920 0  
  5. scsi_dh 42177 1 dm_multipath 
  6. dm_mod 101649 4 dm_mirror,dm_multipath,dm_raid45,dm_log 

在linux下查看PCI设置,lspci命令能列出机器中的PCI信息,比如声卡、显卡、Modem

  1. [root@host /]# lspci | grep Ether 
  2. 02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) 
责任编辑:武晓燕 来源: 今日头条
相关推荐

2017-01-12 20:52:19

Linux服务器运维

2011-02-25 10:58:01

PROFTPD命令

2011-02-24 14:14:22

PROFTPD命令

2022-05-05 09:27:31

Linux服务器优化

2020-06-07 11:54:34

Linux服务器命令

2019-06-13 17:15:30

监控Linux服务器

2023-10-25 06:54:40

MySQL数据库

2011-01-14 16:25:59

Linux服务器集群系统

2010-09-01 09:38:29

设置DHCP服务器

2019-07-31 14:36:46

Linux服务器框架

2010-12-17 09:22:01

Linux服务器性能监控Munin

2010-03-05 14:10:39

Linux服务器内存

2009-12-21 14:48:20

2012-05-07 10:08:25

Linux

2019-02-11 10:05:10

监控Linux命令

2014-04-23 16:43:05

Linux服务器性能分析

2021-04-02 10:50:03

Linux服务器工具

2021-04-09 09:40:41

Linux服务器工具

2021-03-25 12:15:12

Linux服务器内存

2010-01-08 13:54:17

JSON 性能
点赞
收藏

51CTO技术栈公众号