# clear
# dmidecode | grep Product (服务器型号)
Product Name: Lenovo WQ R510 G6
Product Name: DPX1066RK
# cat /proc/cpuinfo | grep name | cut -f2 -d: (说明有8个cpu?)
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
# cat /proc/cpuinfo | grep physical (原来都是4核的,说明只是2个cpu)
physical id : 0
physical id : 0
physical id : 0
physical id : 0
physical id : 1
physical id : 1
physical id : 1
physical id : 1
# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l (CPU是64bit: lm指long mode, 支持lm则是64bit)
8
# free -m
total used free shared buffers cached
Mem: 8105 7974 131 0 69 6989
-/+ buffers/cache: 916 7189
Swap: 6094 46 6048
# uname -a
Linux euis1 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux
# cat /etc/issue | grep Linux
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
# rpm -qa | wc -l
sestatus
912
# sestatus
SELinux status: disabled
hostname
# hostname
euis1
# domainname
(none)
# uptime
14:42:48 up 5 days, 1:55, 5 users, load average: 0.02, 0.06, 0.01
# cat /etc/hosts | grep -v '#'
127.0.0.1 localhost.localdomain localhost
192.168.41.191 euis1
192.168.41.192 euis2
# ifconfig | grep 'inet addr:' | grep -v '127.0.0.1'
inet addr:192.168.41.191 Bcast:192.168.47.255 Mask:255.255.248.0
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=euis1
GATEWAY=192.168.40.1
# cat /etc/resolv.conf
nameserver 202.106.196.113
nameserver 202.106.0.20
# env | egrep 'LANG|LC'
LC_ALL=en_US
LANG=en_US
# fdisk -l | grep Disk
Disk /dev/sda: 145.9 GB, 145999527936 bytes
# df -ha
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 20G 3.1G 16G 17% /
none 0 0 0 - /proc
none 0 0 0 - /sys
none 0 0 0 - /dev/pts
usbfs 0 0 0 - /proc/bus/usb
/dev/sda2 190M 12M 169M 7% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/sda3 20G 906M 18G 5% /home
/dev/sda5 20G 4.7G 15G 26% /orahome
/dev/sda8 4.0G 41M 3.7G 2% /tmp
/dev/sda10 61G 16G 43G 28% /u01
/dev/sda9 4.0G 143M 3.6G 4% /var
none 0 0 0 - /proc/sys/fs/binfmt_misc
#
如果使用的是SecureCRT软件登陆服务器, 那么以上命令不用一个个敲, 像下面这样写成一个vbs脚本, 然后在 secureCRT - Script - Run 里选择运行这个vbs脚本即可. 是不是很方便?!
linux_info(root).vbs
----------------------------------------------------------------------------------------------------
#$language = "VBScript"
#$interface = "1.0"
Sub Main
'清空屏幕
crt.Screen.Send "clear" & chr(13)
'服务器型号
crt.Screen.WaitForString "# "
crt.Screen.Send "dmidecode | grep Product" & chr(13)
'CPU(型号,多核信息, CPU位数: lm指long mode, 支持lm则是64bit)
crt.Screen.WaitForString "# "
crt.Screen.Send "cat /proc/cpuinfo | grep name | cut -f2 -d:" & chr(13)
crt.Screen.Send "cat /proc/cpuinfo | grep physical" & chr(13)
crt.Screen.Send "cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l " & chr(13)
'内存
crt.Screen.WaitForString "# "
crt.Screen.Send "free -m" & chr(13)
'操作系统内核和版本
crt.Screen.WaitForString "# "
crt.Screen.Send "uname -a" & chr(13)
crt.Screen.WaitForString "# "
crt.Screen.Send "cat /etc/issue | grep Linux" & chr(13)
'已经安装的软件包个数
crt.Screen.WaitForString "# "
crt.Screen.Send "rpm -qa | wc -l" & chr(13)
'selinux情况
crt.Screen.WaitForString "# "
crt.Screen.Send "sestatus" & chr(13)
'主机名和域名
crt.Screen.WaitForString "# "
crt.Screen.Send "hostname" & chr(13)
crt.Screen.WaitForString "# "
crt.Screen.Send "domainname" & chr(13)
'运行时间
crt.Screen.WaitForString "# "
crt.Screen.Send "uptime" & chr(13)
'IP
crt.Screen.WaitForString "# "
crt.Screen.Send "cat /etc/hosts | grep -v '#'" & chr(13)
crt.Screen.WaitForString "# "
crt.Screen.Send "ifconfig | grep 'inet addr:' | grep -v '127.0.0.1'" & chr(13)
'gateway
crt.Screen.WaitForString "# "
crt.Screen.Send "cat /etc/sysconfig/network" & chr(13)
'DNS
crt.Screen.WaitForString "# "
crt.Screen.Send "cat /etc/resolv.conf" & chr(13)
'系统语言环境变量
crt.Screen.WaitForString "# "
crt.Screen.Send "env | egrep 'LANG|LC'" & chr(13)
'主机空间
crt.Screen.WaitForString "# "
crt.Screen.Send "fdisk -l | grep Disk" & chr(13)
crt.Screen.WaitForString "# "
crt.Screen.Send "df -ha" & chr(13)
End Sub
----------------------------------------------------------------------------------------------------
--End--
阅读(823) | 评论(0) | 转发(0) |