Collect some Linux commands and methods for viewing system information:
One, Linux view server System Information method:
1. View host name/kernel version/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 language Character Set settings:
- # echo $LANG $LANGUAGE
- Zh_cn. UTF-8
- # cat/etc/sysconfig/i18n
- Lang= "ZH_CN. UTF-8 "
4. View Users:
- # WhoAmI #查看当前登录用户名
- # ID #查看当前用户及其属组
- # W #查看当前登录的用户及运行的命令
- # Last #查看最近登录用户
- # cat/etc/passwd|awk-f: ' {print '} ' #查看服务器上面所有用户
5. View other System Information:
- # date ' +%y-%m-%d%h:%m:%s ' #查看系统时间
- # Ps-ef #查看运行进程
- # uptime #查看服务器开机时长, number of users, average load
- # Lsmod #查看所有加载的模块
- # env #查系统环境变量
- # crontab-l #查看计划任务
Second, Linux view server hardware device information:
1. View Server CPU Information:
- # grep ' model name '/proc/cpuinfo|awk-f: ' {print $} ' |sed ' s# # #g ' |uniq-c
- 8 Intel (R) Xeon (R) CPU E5630 @ 2.53GHz #8个核心的Intel Xeon CPU
2. View the number of server CPU bits:
- # getconf Long_bit
- 32
3. Check the network card model:
- # LSPCI |grep Ethernet
- Ethernet controller:broadcom Corporation netxtreme II BCM5709 Gigabit Ethernet (rev. 20)
4. View additional hardware information:
- # Lspci-tv #查看所有PCI设备
- # Lsusb-tv #查看所有usb外设
- # Cat/etc/sysconfig/keyboard #查看键盘布局
Linux Learning, HTTP //linux.it.net.cn
Third, Linux view server storage information:
1. View memory Information:
- # sed-n '/memtotal\| Memfree/p '/proc/meminfo
- memtotal:16426736 KB
- memfree:14171748 KB
2. View swap space:
- # sed-n '/swaptotal\| Swapfree/p '/proc/meminfo
- swaptotal:16771852 KB
- swapfree:16771852 KB
3. View mount partition space usage:
- # Df-h
- File system capacity has been used with available% mount points
- /dev/sda6 9.7G 570M 8.7G 7%/
- /dev/sda7 3.9G 73M 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 92M 12M 75M 14%/boot
- Tmpfs 7.9G 0 7.9G 0%/dev/shm
Iv. Linux View server network information:
1. View the Linux system hostname:
- # hostname
- Localhost.localdomain
2. View server IP address: It network, http://www.it.net.cn
- # Ifconfig|grep ' inet addr: ' |grep-v ' 127.0.0.1 ' |cut-d:-f2|awk ' {print '} '
- 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 ports:
- # NETSTAT-LNTP #查看监听 (Listen) port
- # NETSTAT-ANTP #查看所有建立的TCP连接
5. View Linux Open service:
- # chkconfig--list|grep Enable #查看开启的服务
- sshd 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off
- httpd 0: Off 1: Off 2: Off 3: Enabled 4: Off 5: off 6: Off
6. View Server DNS configuration:
- # cat/etc/resolv.conf
- NameServer 192.168.0.66
- NameServer 202.106.0.20
7. Other Network information:
- # Iptables-l #查看防火墙规则
- # route-n #查看路由表
- # netstat-s #查看网络统计信息
CentOS View System Information commands and methods