一:cpu
[root@test ~]# more /proc/cpuinfo | grep "model name"
model name : Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz
[root@test ~]# more /proc/cpuinfo | grep "model name" | cut -d : -f 2-
Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz
二:内存
[root@test ~]# grep MemTotal /proc/meminfo
MemTotal: 2058496 kB
[root@test ~]# free -m
total used free shared buffers cached
Mem: 2010 604 1405 0 27 327
-/+ buffers/cache: 249 1760
Swap: 2015 0 2015
#查看物理内存大小
[root@test ~]# free -m |grep "Mem" | awk '{print $2}'
2010
三:查看CPU位数(32 or 64)
[root@test ~]# getconf LONG_BIT
64
四:查看linux版本
[root@test ~]# more /etc/redhat-release
CentOS release 5.4 (Final)
[root@test ~]# more /etc/issue
CentOS release 5.4 (Final)
Kernel \r on an \m
[root@test ~]# more /proc/version
Linux version 2.6.18-164.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 S
MP Thu Sep 3 03:28:30 EDT 2009
五:查看内核版本
[root@test ~]# uname -r
2.6.18-164.el5
[root@test ~]# uname -a
Linux test.chensiyao.com 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
六:查看时区
[root@test ~]# date -R
Tue, 28 Aug 2012 10:00:01 +0800
# 时区文件在/etc/locatime,示例修改时区:
[root@srv /]# mv /etc/localtime /etc/localtime.save
[root@srv /]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@srv /]# date -R
Tue, 28 Aug 2012 10:00:01 +0800
七:主机名
# 查看主机名
[root@test ~]# hostname
test.chensiyao.com
# 修改主机名
[root@test ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=test.chensiyao.com
八:查看selinux情况
[root@test ~]# sestatus
SELinux status: disabled
九:网络
IP
[root@test ~]# ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
192.168.10.123
网关
[root@test ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep 'GATEWAY'
GATEWAY=192.168.10.1
dns
[root@test ~]# cat /etc/resolv.conf
nameserver 202.96.128.166
nameserver 8.8.8.8
修改Host文件
[root@test ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
十:已经安装的软件包
#查看已安装软件
[root@srv /]# rpm -qa | grep 'java'
#已安装软件包数量
[root@srv /]# rpm -qa | wc -l
197
[root@srv /]# yum list installed | wc -l
198
十一:磁盘和分区
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 5.4G 11G 33% /
/dev/sda1 289M 17M 258M 6% /boot
tmpfs 1006M 0 1006M 0% /dev/shm
[root@srv /]# du -sh
353M
[root@srv /]# du /etc -sh
4.6M /etc
九:查看键盘布局
[root@test ~]# cat /etc/sysconfig/keyboard
KEYBOARDTYPE="pc"
KEYTABLE="us"
[root@test ~]# cat /etc/sysconfig/keyboard | grep KEYTABLE | cut -f2 -d=
"us"
十二:查看默认语言
[root@test ~]# echo $LANG $LANGUAGE
en_US.UTF-8
[root@test ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
十三:进程
# 查看所有进程
[root@test ~]# ps -ef
# 实时显示进程状态
[root@test ~]# top
十四:用户
# 查看活动用户
[root@test ~]# w
# 查看指定用户信息
[root@test ~]# id
# 查看用户登录日志
[root@test ~]# last
# 查看系统所有用户
[root@test ~]# cat /etc/passwd | cut -d : -f 1
# 查看系统所有组
[root@test ~]# cat /etc/group | cut -d : -f 1
# 查看当前用户的计划任务
[root@test ~]# crontab -l
十五:其它
# 查看系统运行时间、用户数、负载
[root@test ~]# uptime
10:11:06 up 29 min, 1 user, load average: 0.01, 0.06, 0.06
# 查看系统负载
[root@test ~]# cat /proc/loadavg
0.00 0.05 0.05 1/411 4626
# 查看路由表
[root@test ~]# route -n
# 查看所有监听端口
[root@test ~]# netstat -lntp