CentOS command and method for viewing system information
Collect and organize commands and methods for viewing system information in linux:
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