The commands and methods used to view system information under the collected Linux system will be useful to you. 1. How to view server system information in Linux:
1. Check the host name, kernel version, and CPU architecture:
-
# Uname-n-r-p-o
-
Localhost. localdomain 2.6.32-220. el6.i686 i686
2. view the Linux system type and version:
-
# Head-N 1/etc/issue
-
Centos Release 6.2 (final)
3. view the Language Character Set settings:
-
# Echo $ Lang $ Language
-
Zh_CN.UTF-8
-
# Cat/etc/sysconfig/i18n
-
Lang = "zh_CN.UTF-8"
4. View users:
-
# Whoami # view the current logon User Name
-
# ID # view the current user and its Group
-
# W # view currently logged on users and running commands
-
# Last # view recently logged on users
-
# Cat/etc/passwd | awk-F: '{print $1}' # view all users on the server
5. view other system information:
-
# Date '+ % Y-% m-% d % H: % m: % s' # view system time
-
# Ps-Ef # view running processes
-
# Uptime # view the server startup duration, number of users, and average load
-
# Lsmod # view all loaded modules
-
# Env # Check System Environment Variables
-
# Crontab-L # view scheduled tasks
Ii. View server hardware information in Linux:
1. view the server CPU information:
-
# Grep 'model name'/proc/cpuinfo | awk-F: '{print $2}' | SED's ### G' | uniq-C
-
8 Intel (r) Xeon (r) CPU e5630 @ 2.53 GHz #8-core Intel Xeon CPU
2. view the server CPU count:
-
# Getconf long_bit
-
32
3. view the NIC model:
-
# Lspci | grep Ethernet
-
Ethernet controller: Broadcom Corporation netxtreme II bcm5709 Gigabit Ethernet (Rev 20)
4. view other hardware information:
-
# Lspci-TV # view all PCI devices
-
# Lsusb-TV # view all USB peripherals
-
# Cat/etc/sysconfig/keyboard # view keyboard layout
Iii. View server storage Information in Linux:
1. view memory information:
-
# Sed-n'/memtotal \ | memfree/P'/proc/meminfo
-
Memtotal: 16426736 KB
-
Memfree: 14171748 KB
2. view the swap space:
-
# Sed-n'/swaptotal \ | swapfree/P'/proc/meminfo
-
Swaptotal: 16771852 KB
-
Swapfree: 16771852 KB
3. view the usage of the mounted partition space:
-
# DF-H
-
File System capacity used available % mount point
-
/Dev/sda6 9.7g 570 M 8.7g 7%/
-
/Dev/sda7 3.9g 73 m 3.7g 2%/tmp
-
/Dev/sda2 20g 2.5G 16g 14%/var
-
/Dev/sda8 388g 4.9g 363g 2%/storage
-
/Dev/sda5 15g 2.4g 12g 18%/usr
-
/Dev/sda1 92 MB 12 m 75 m 14%/boot
-
Tmpfs 7.9g 0 7.9g 0%/dev/SHM
4. View server network information in Linux:
1. Check the Linux host name:
-
# Hostname
-
Localhost. localdomain
2. view the Server IP Address:
-
# Ifconfig | grep 'inet ADDR: '| grep-V' 127. 0.0.1' | cut-D:-F2 | awk '{print $1 }'
-
192.168.17.238
-
192.168.1.9
3. view the Linux Gateway:
-
# Route | grep default
-
Default 192.168.1.1 0.0.0.0 ug 0 0 0 Em1
4. view the Linux Port:
-
# Netstat-lntp # view the listening port (Listen)
-
# Netstat-antp # view all established TCP connections
5. view the Linux service:
-
# Chkconfig -- list | grep enabled # view enabled services
-
Sshd 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable
-
Httpd 0: Disabled 1: Disabled 2: Disabled 3: enabled 4: Disabled 5: Disabled 6: Disabled
6. view the DNS configuration of the server:
-
# Cat/etc/resolv. conf
-
Nameserver 192.168.0.66
-
Nameserver 202.106.0.20
7. other network information:
-
# Iptables-L # view firewall rules
-
# Route-N # view the route table
-
# Netstat-s # view network statistics
This article is from the blog "getting hurt with the red dust". For more information, contact the author!