Bone Study Notes
When we enter a new Linux server environment, we should quickly learn the basic hardware and software information of the server. The following is an example:
# Clear
# Dmidecode | grep Product (Server Model)
Product Name: Lenovo WQ R510 G6
Product Name: DPX1066RK
# Cat/proc/cpuinfo | grep name | cut-f2-d: (which indicates there are 8 CPUs ?)
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
# Cat/proc/cpuinfo | grep physical (Originally 4-core, indicating only 2 CPUs)
Physical id: 0
Physical id: 0
Physical id: 0
Physical id: 0
Physical id: 1
Physical id: 1
Physical id: 1
Physical id: 1
# Getconf LONG_BIT (and 32-bit cpu)
32
# Free-m
Total used free shared buffers cached
Mem: 8105 7974 131 0 69 6989
-/+ Buffers/cache: 916 7189
Swap: 6094 46 6048
# Uname-
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, 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 190 M 12 M 169 M 7%/boot
None 4.0G 0 4.0G 0%/dev/shm
/Dev/sda3 20G 906 M 18G 5%/home
/Dev/sda5 20g 4.7G 15G 26%/orahome
/Dev/sda8 4.0G 41 M 3.7G 2%/tmp
/Dev/sda10 61G 16G 43G 28%/u01
/Dev/sda9 4.0G 143 M 3.6G 4%/var
None 0 0 0-/proc/sys/fs/binfmt_misc
#
If you are using the SecureCRT software to log on to the server, the above commands do not need to be typed one by one. As shown below, you can write a vbs script, then Run the vbs Script in secureCRT-Script-Run. is it very important ?!
Linux_info (root). vbs
ASP/Visual Basic Code
# $ Language = "VBScript"
# $ Interface = "1.0"
Sub Main
Clear Screen
Crt. Screen. Send "clear" & chr (13)
Server Model
Crt. Screen. WaitForString "#"
Crt. Screen. Send "dmidecode | grep Product" & chr (13)
CPU (model, multi-core information, number of digits)
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 "getconf LONG_BIT" & chr (13)
Memory
Crt. Screen. WaitForString "#"
Crt. Screen. Send "free-m" & chr (13)
Operating system kernel and version
Crt. Screen. WaitForString "#"
Crt. Screen. Send "una