查看Linux服务器各种信息方法

时间:2023-03-09 04:13:55
查看Linux服务器各种信息方法

有的时候需要搜集服务器的各种信息,比如cpu信息,内存信息,linux版本信息,安装的各种软件信息等等。下面总结几种主要指标的查看方法。

1. 查看Linux发行版信息
查看Linux服务器各种信息方法[root@pcmweb ~]# cat /etc/issue
查看Linux服务器各种信息方法Red Hat Enterprise Linux Server release 5 (Tikanga)
查看Linux服务器各种信息方法Kernel   on an m
2.查看Linux内核信息
查看Linux服务器各种信息方法[root@pcmweb ~]# uname -r
查看Linux服务器各种信息方法2.6.18-8.el5xen
3.查看cpu信息
查看Linux服务器各种信息方法[root@pcmxexdb ~]# cat /proc/cpuinfo 
查看Linux服务器各种信息方法processor       : 0
查看Linux服务器各种信息方法vendor_id       : GenuineIntel
查看Linux服务器各种信息方法cpu family      : 6
查看Linux服务器各种信息方法model           : 23
查看Linux服务器各种信息方法model name      : Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
查看Linux服务器各种信息方法stepping        : 6
查看Linux服务器各种信息方法cpu MHz         : 2992.540
查看Linux服务器各种信息方法cache size      : 6144 KB
查看Linux服务器各种信息方法physical id     : 0
查看Linux服务器各种信息方法siblings        : 4
查看Linux服务器各种信息方法core id         : 0
查看Linux服务器各种信息方法cpu cores       : 4
查看Linux服务器各种信息方法fpu             : yes
查看Linux服务器各种信息方法fpu_exception   : yes
查看Linux服务器各种信息方法cpuid level     : 10
查看Linux服务器各种信息方法wp              : yes
查看Linux服务器各种信息方法flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
查看Linux服务器各种信息方法bogomips        : 5989.06
查看Linux服务器各种信息方法clflush size    : 64
查看Linux服务器各种信息方法cache_alignment : 64
查看Linux服务器各种信息方法address sizes   : 38 bits physical, 48 bits virtual
查看Linux服务器各种信息方法power management:
查看Linux服务器各种信息方法 
查看Linux服务器各种信息方法processor       : 1
查看Linux服务器各种信息方法vendor_id       : GenuineIntel
查看Linux服务器各种信息方法cpu family      : 6
查看Linux服务器各种信息方法model           : 23
查看Linux服务器各种信息方法model name      : Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
查看Linux服务器各种信息方法stepping        : 6
查看Linux服务器各种信息方法cpu MHz         : 2992.540
查看Linux服务器各种信息方法cache size      : 6144 KB
查看Linux服务器各种信息方法physical id     : 1
查看Linux服务器各种信息方法siblings        : 4
查看Linux服务器各种信息方法core id         : 0
查看Linux服务器各种信息方法cpu cores       : 4
查看Linux服务器各种信息方法fpu             : yes
查看Linux服务器各种信息方法fpu_exception   : yes
查看Linux服务器各种信息方法cpuid level     : 10
查看Linux服务器各种信息方法wp              : yes
查看Linux服务器各种信息方法flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
查看Linux服务器各种信息方法bogomips        : 5985.40
查看Linux服务器各种信息方法clflush size    : 64
查看Linux服务器各种信息方法cache_alignment : 64
查看Linux服务器各种信息方法address sizes   : 38 bits physical, 48 bits virtual
查看Linux服务器各种信息方法power management:
查看Linux服务器各种信息方法 
查看Linux服务器各种信息方法processor       : 2
查看Linux服务器各种信息方法vendor_id       : GenuineIntel
查看Linux服务器各种信息方法cpu family      : 6
查看Linux服务器各种信息方法model           : 23
查看Linux服务器各种信息方法model name      : Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
查看Linux服务器各种信息方法stepping        : 6
查看Linux服务器各种信息方法cpu MHz         : 2992.540
查看Linux服务器各种信息方法cache size      : 6144 KB
查看Linux服务器各种信息方法physical id     : 0
查看Linux服务器各种信息方法siblings        : 4
查看Linux服务器各种信息方法core id         : 1
查看Linux服务器各种信息方法cpu cores       : 4
查看Linux服务器各种信息方法fpu             : yes
查看Linux服务器各种信息方法fpu_exception   : yes
查看Linux服务器各种信息方法cpuid level     : 10
查看Linux服务器各种信息方法wp              : yes
查看Linux服务器各种信息方法flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
查看Linux服务器各种信息方法bogomips        : 5985.02
查看Linux服务器各种信息方法clflush size    : 64
查看Linux服务器各种信息方法cache_alignment : 64
查看Linux服务器各种信息方法address sizes   : 38 bits physical, 48 bits virtual
查看Linux服务器各种信息方法power management:
查看Linux服务器各种信息方法 
查看Linux服务器各种信息方法。。。。。。。。。。。。。。。。。。(省略若干行)查看Linux服务器各种信息方法 
查看Linux服务器各种信息方法processor       : 7
查看Linux服务器各种信息方法vendor_id       : GenuineIntel
查看Linux服务器各种信息方法cpu family      : 6
查看Linux服务器各种信息方法model           : 23
查看Linux服务器各种信息方法model name      : Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
查看Linux服务器各种信息方法stepping        : 6
查看Linux服务器各种信息方法cpu MHz         : 2992.540
查看Linux服务器各种信息方法cache size      : 6144 KB
查看Linux服务器各种信息方法physical id     : 1
查看Linux服务器各种信息方法siblings        : 4
查看Linux服务器各种信息方法core id         : 3
查看Linux服务器各种信息方法cpu cores       : 4
查看Linux服务器各种信息方法fpu             : yes
查看Linux服务器各种信息方法fpu_exception   : yes
查看Linux服务器各种信息方法cpuid level     : 10
查看Linux服务器各种信息方法wp              : yes
查看Linux服务器各种信息方法flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
查看Linux服务器各种信息方法bogomips        : 5985.29
查看Linux服务器各种信息方法clflush size    : 64
查看Linux服务器各种信息方法cache_alignment : 64
查看Linux服务器各种信息方法address sizes   : 38 bits physical, 48 bits virtual
查看Linux服务器各种信息方法power management:

这样显示出来的信息很复杂,不容易看出结果。其实上面一大篇中有用的信息只有2条(processor和physical id)可以用命令来简化一下。命令如下:

physical id (如下,代表这个机器一共有2个cpu,0是一个,1是一个)

查看Linux服务器各种信息方法[root@pcmxexdb ~]# cat /proc/cpuinfo |grep "physical id"
查看Linux服务器各种信息方法physical id     : 0
查看Linux服务器各种信息方法physical id     : 1
查看Linux服务器各种信息方法physical id     : 0
查看Linux服务器各种信息方法physical id     : 1
查看Linux服务器各种信息方法physical id     : 0
查看Linux服务器各种信息方法physical id     : 1
查看Linux服务器各种信息方法physical id     : 0
查看Linux服务器各种信息方法physical id     : 1

processor(如下,表示一共有8个核)

查看Linux服务器各种信息方法[root@pcmxexdb ~]# cat /proc/cpuinfo |grep processor
查看Linux服务器各种信息方法processor       : 0
查看Linux服务器各种信息方法processor       : 1
查看Linux服务器各种信息方法processor       : 2
查看Linux服务器各种信息方法processor       : 3
查看Linux服务器各种信息方法processor       : 4
查看Linux服务器各种信息方法processor       : 5
查看Linux服务器各种信息方法processor       : 6
查看Linux服务器各种信息方法processor       : 7

综上,这个机器一共有2个4核的CPU。

4.查看内存信息
查看Linux服务器各种信息方法[root@pcmxexdb ~]# cat /proc/meminfo 
查看Linux服务器各种信息方法MemTotal:      8174388 kB
查看Linux服务器各种信息方法MemFree:       4130912 kB
查看Linux服务器各种信息方法。。。。。。。。。。。。。。(省略若干)
查看Linux服务器各种信息方法SwapTotal:     8393952 kB
查看Linux服务器各种信息方法。。。。。。。。。。。。。。

一共8G内存,8G的swap空间。

5.查看硬盘信息
查看Linux服务器各种信息方法[root@pcmweb ~]# fdisk -l
查看Linux服务器各种信息方法 
查看Linux服务器各种信息方法Disk /dev/sda: 1499.8 GB, 1499883110400 bytes
查看Linux服务器各种信息方法255 heads, 63 sectors/track, 182350 cylinders
查看Linux服务器各种信息方法Units = cylinders of 16065 * 512 = 8225280 bytes
查看Linux服务器各种信息方法 
查看Linux服务器各种信息方法   Device Boot      Start         End      Blocks   Id  System
查看Linux服务器各种信息方法/dev/sda1   *           1          13      104391   83  Linux
查看Linux服务器各种信息方法/dev/sda2              14      182350  1464621952+  8e  Linux LVM

硬盘空间一共是1.5T左右。

6.查看分区信息
查看Linux服务器各种信息方法[root@pcmweb ~]# df -h
查看Linux服务器各种信息方法文件系统              容量  已用 可用 已用% 挂载点
查看Linux服务器各种信息方法/dev/mapper/VG00-LV04
查看Linux服务器各种信息方法                      307G  5.0G  286G   2% /
查看Linux服务器各种信息方法/dev/sda1              99M   12M   82M  13% /boot
查看Linux服务器各种信息方法tmpfs                 3.9G     0  3.9G   0% /dev/shm
查看Linux服务器各种信息方法/dev/mapper/VG00-LV03
查看Linux服务器各种信息方法                      757G  2.1G  716G   1% /ftp
查看Linux服务器各种信息方法/dev/mapper/VG00-LV01
查看Linux服务器各种信息方法                      3.9G  137M  3.6G   4% /tmp
查看Linux服务器各种信息方法/dev/mapper/VG00-LV02
查看Linux服务器各种信息方法                      284G  541M  269G   1% /usr/local