CPU信息:
CPU型号:
1
2
3
4
5
|
[root@localhost ~]
# cat /proc/cpuinfo |grep name|awk -F ':' '{print $2}'|uniq -c
8 Intel(R) Xeon(R) CPU X5650 @ 2.67GHz
[root@localhost ~]
# cat /proc/cpuinfo |grep name|cut -d ':' -f 2|uniq -c
8 Intel(R) Xeon(R) CPU X5650 @ 2.67GHz
[root@localhost ~]
#
|
查看逻辑CPU的个数
1
2
3
|
[root@localhost logs]
# cat /proc/cpuinfo| grep "processor"| wc -l
8
[root@localhost logs]
#
|
查看每个物理CPU中core的个数(即核数)
1
2
3
|
[root@localhost logs]
# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 4
[root@localhost logs]
#
|
物理CPU个数:
1
2
3
4
5
|
[root@localhost ~]
# cat /proc/cpuinfo |grep physical|sort|uniq -c
8 address sizes : 40 bits physical, 48 bits virtual
4 physical
id
: 0
4 physical
id
: 1
[root@localhost ~]
#
|
2个4核CPU
总核数 = 物理CPU个数 X 每颗物理CPU的核数
总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
运行位数:
1
2
3
|
[root@localhost ~]
# getconf LONG_BIT
64
[root@localhost ~]
#
|
当前CPU工作在64位模式下(即操作系统是64位的),如果显示的是32并不表示CPU一定是32位的(64位的也可以当32位的来用),要查看cpu是否支持64bit,方法如下:
1
2
3
|
[root@localhost ~]
# cat /proc/cpuinfo |grep flags|grep "lm"|wc -l
8
[root@localhost ~]
#
|
如果flags中有lm,则表示支持64位,lm的意思是long mode
即如结果大于0, 说明支持64bit处理模式,64位的CPU必须运行在64位的操作系统下,才能实现64位的运算模式。
服务器型号查询:
1
2
3
4
|
[root@BETA6 yum.repos.d]
# dmidecode |grep -i "product name"
Product Name: PowerEdge R620
Product Name: 0D2D5F
[root@BETA6 yum.repos.d]
#
|
查看linux主机是否虚拟机还是物理机:
1
2
3
4
5
6
7
8
9
10
11
|
[root@Port_Forward ~]
# lspci -b|grep -i vmware
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
[root@Port_Forward ~]
# dmidecode |grep -i vmware
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Serial Number: VMware-42 0b 96 a0 da
dd
91 17-d8 3d 89 e8 56 f4 5e c1
Description: VMware SVGA II
[root@Port_Forward ~]
#
|
lspci:显示外围设备总线/总览。dmidecode:桌面管理接口。
内存信息:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@localhost ~]
# cat /proc/meminfo |grep -i mem
MemTotal: 8061068 kB
MemFree: 7136744 kB
Shmem: 388 kB
[root@localhost ~]
# cat /proc/meminfo |grep Swap
SwapCached: 0 kB
SwapTotal: 2097144 kB
SwapFree: 2097144 kB
[root@localhost ~]
# free -m
total used
free
shared buffers cached
Mem: 7872 1069 6802 0 56 376
-/+ buffers
/cache
: 637 7234
Swap: 2047 0 2047
[root@localhost ~]
#
|
从上图中可看到当前系统内存总大小为7872(单位是k)已经使用1069,剩余6802。其实真正剩余并不是这个6802,而是第二行的7234,真正使用的也是第二行的637。这是因为系统初始化时,就已经分配出很大一部分内存给缓存,这部分缓存用来随时提供给程序使用,如果程序不用,那这部分内存就空闲。所以,查看内存使用多少,剩余多少请看第二行的数据。另外你还可以加-m 或者-g选项分别以M或G为单位打印内存使用状况。
硬盘信息:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
[root@localhost ~]
# fdisk -l
Disk
/dev/sda
: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors
/track
, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical
/physical
): 512 bytes / 512 bytes
I
/O
size (minimum
/optimal
): 512 bytes / 512 bytes
Disk identifier: 0x0000e824
Device Boot Start End Blocks Id System
/dev/sda1
* 1 13 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2
13 274 2097152 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3
274 2089 14576640 83 Linux
[root@justin ~]
# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda2
ext4 10321208 4635280 5161640 48% /
tmpfs tmpfs 515396 0 515396 0%
/dev/shm
/dev/sda1
ext4 198337 26679 161418 15%
/boot
/dev/sda5
ext4 8053168 149244 7494836 2%
/home
/dev/sdb5
ext3 505572 10543 468927 3%
/newdisk
[root@justin ~]
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2
ext4 9.9G 4.5G 5.0G 48% /
tmpfs tmpfs 504M 0 504M 0%
/dev/shm
/dev/sda1
ext4 194M 27M 158M 15%
/boot
/dev/sda5
ext4 7.7G 146M 7.2G 2%
/home
/dev/sdb5
ext3 494M 11M 458M 3%
/newdisk
[root@justin ~]
#
|
测试硬盘写入速度:
1
2
3
4
5
|
[root@localhost ~]
# dd if=/dev/zero of=/tmp/output.img bs=1M count=256
256+0 records
in
256+0 records out
268435456 bytes (268 MB) copied, 8.56778 s, 31.3 MB
/s
[root@localhost ~]
#
|
测试硬盘读取速度:
1
2
3
4
5
6
|
[root@localhost ~]
# hdparm -Tt /dev/sda
/dev/sda
:
Timing cached reads: 6652 MB
in
2.00 seconds = 3327.09 MB
/sec
Timing buffered disk reads: 80 MB
in
3.05 seconds = 26.26 MB
/sec
[root@localhost ~]
#
|
获取文本的md5 hash:
1
2
3
|
[root@localhost ~]
# echo -n "justin"|md5sum
53dd9c6005f3cdfc5a69c5c07388016d -
[root@localhost ~]
#
|
Swap分区信息:
1
2
3
4
5
6
7
|
[root@localhost ~]
# swapon -s
Filename Type Size Used Priority
/dev/sda2
partition 2097144 0 -1
[root@localhost ~]
# cat /proc/swaps
Filename Type Size Used Priority
/dev/sda2
partition 2097144 0 -1
[root@localhost ~]
#
|
UUID:
1
2
3
4
5
6
7
8
9
|
[root@localhost ~]
# blkid
/dev/sda3
: UUID=
"eee214fe-4b64-44b6-8b3c-ed0f8e63e32a"
TYPE=
"ext4"
/dev/sda1
: UUID=
"fc233792-7e59-487c-8359-a464b7b66097"
TYPE=
"ext4"
/dev/sda2
: UUID=
"680ec16a-b4e9-4dc8-8bee-aaf45587e173"
TYPE=
"swap"
[root@localhost ~]
# ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx. 1 root root 10 Dec 6 09:48 680ec16a-b4e9-4dc8-8bee-aaf45587e173 -> ../..
/sda2
lrwxrwxrwx. 1 root root 10 Dec 6 09:48 eee214fe-4b64-44b6-8b3c-ed0f8e63e32a -> ../..
/sda3
lrwxrwxrwx. 1 root root 10 Dec 6 09:48 fc233792-7e59-487c-8359-a464b7b66097 -> ../..
/sda1
|
补:查看某一文件(夹)大小
1
2
3
|
[root@localhost src]
# du -sh nagios-plugins-1.4.16.tar.gz
2.0M nagios-plugins-1.4.16.
tar
.gz
[root@localhost src]
#
|
查看当前系统安装的软件包数量
1
2
3
|
[root@justin home]
# cat -n /root/install.log|wc -l
1099
[root@justin home]
#
|
网卡信息:
1
2
3
4
5
6
7
8
9
10
11
12
|
[root@localhost ~]
# dmesg |grep -i eth
e1000 0000:02:00.0: eth0: (PCI:66MHz:32-bit) 00:50:56:be:47:3b
e1000 0000:02:00.0: eth0: Intel(R) PRO
/1000
Network Connection
e1000 0000:02:02.0: eth1: (PCI:66MHz:32-bit) 00:50:56:96:37:60
e1000 0000:02:02.0: eth1: Intel(R) PRO
/1000
Network Connection
e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
ADDRCONF(NETDEV_UP): eth0: link is not ready
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
eth0: no IPv6 routers present
eth1: no IPv6 routers present
[root@localhost ~]
#
|
判断网卡速率
ethtool ethx 查看支持的速率
网卡的最大速率可以看Speed: 1000Mb/s,Duple:Full 全双工;实际网卡速率和网线,交换机端口速率有关,Auto-negotiation on表示开启自动协商,插上网线后会两端会自动协商一个都支持的速率
Link detected yes 表示网卡插好网线了(亮了),插好网线激活网卡(ifup ethx, 其实是二层up)才会yes
查看网卡驱动 ethtool -i ethx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@localhost ~]
# ethtool -i ens33
driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:02:01.0
supports-statistics:
yes
supports-
test
:
yes
supports-eeprom-access:
yes
supports-register-dump:
yes
supports-priv-flags: no
[root@localhost ~]
# lspci -vv | grep Eth 查看网卡型号
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
[root@localhost ~]
# lspci | grep Eth 查看网卡型号
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
[root@localhost ~]
#
|
机器型号:
1
2
3
4
|
[root@localhost ~]
# dmidecode |grep -i "product name"
Product Name: VMware Virtual Platform
Product Name: 440BX Desktop Reference Platform
[root@localhost ~]
#
|
内核信息:
1
2
3
4
5
6
7
|
[root@localhost ~]
# uname -r
2.6.32-431.el6.x86_64
[root@localhost ~]
# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64
#1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]
# uname -i
x86_64
[root@localhost ~]
#
|
系统版本信息:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
[root@justin ~]
# cat /etc/issue
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m
[root@justin ~]
#
[root@justin ~]
# cat /etc/*release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@justin ~]
#
[root@justin ~]
# cat /etc/*release|sort|uniq -c
2 Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@justin ~]
#
[root@justin ~]
# lsb_release -a
LSB Version: :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.3 (Santiago)
Release: 6.3
Codename: Santiago
[root@justin ~]
#
[root@justin ~]
# cat /proc/version
Linux version 2.6.32-279.el6.i686 (mockbuild@x86-010.build.bos.redhat.com) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) )
#1 SMP Wed Jun 13 18:23:32 EDT 2012
[root@justin ~]
#
[root@justin ~]
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@justin ~]
#
[root@justin ~]
# rpm -q centos-release
package centos-release is not installed
[root@justin ~]
#
|
系统支持的文件系统类型:
1
2
3
4
5
6
7
8
9
10
11
|
[root@justin ~]
# cat /etc/filesystems
ext4
ext3
ext2
nodev proc
nodev devpts
iso9660
vfat
hfs
hfsplus
[root@justin ~]
#
|
内核模块信息
显示已加载的模块
1
2
|
[root@Port_Forward ~]
# lsmod
[root@Port_Forward ~]
# lsmod |grep bridge
|
加载RAID1阵列级别模块
1
|
[root@Port_Forward ~]
# modprobe raid1
|
删除RAID1阵列级别模块
1
|
[root@Port_Forward ~]
# modprobe -r raid1
|
modprobe命令在加载模块时会自动解决依赖的模块。当加载的模块需依赖另一个模块时,系统会自动将此模块加载。而当用户使用insmod命令加载模块时,则不会自动解决相对应的依赖模块。modprobe命令中的"-r"参数表示删除指定模块,"-c"参数表示显示/etc/modprobe.conf配置文件的参数,"-C"参数表示指定内核配置文件,"-f"表示覆盖,"-l"表示显示模块的绝对路径。