操作系统:CentOS release 6.6 (Final)
说明:RedHat、CentOS、Debian、Ubuntu、FreeBSD等系统都是基于linux内核源代码,所以在原理和操作上既有很多是相似的,也有各自的特性。
一:查看cpu信息
[[email protected] /]# grep "model name" /proc/cpuinfo
model name : Pentium(R) Dual-Core CPU E5200 @ 2.50GHz
model name : Pentium(R) Dual-Core CPU E5200 @ 2.50GHz
[[email protected] /]# grep "CPU" /proc/cpuinfo
model name : Pentium(R) Dual-Core CPU E5200 @ 2.50GHz
model name : Pentium(R) Dual-Core CPU E5200 @ 2.50GHz
二:查看内存信息
grep MemTotal /proc/meminfo
[[email protected] /]# grep MemTotal /proc/meminfo | free -m
total used free shared buffers cached
Mem: 1876 1788 88 0 215 995
-/+ buffers/cache: 576 1299
Swap: 2023 0 2023
三:查看cpu是32位还是64位
[[email protected] /]# getconf LONG_BIT
64
四:查看当前linux的版本信息
[[email protected] /]# cat /etc/issue #查看具体操作系统类型
CentOS release 6.6 (Final)
Kernel \r on an \m
more /etc/ centos-release
[[email protected] /]# cat /etc/centos-release
CentOS release 6.6 (Final)
五:查看内核版本
[[email protected] /]# uname -r
2.6.32-504.1.3.el6.x86_64
[[email protected] /]# uname -a
Linux sky9896 2.6.32-504.1.3.el6.x86_64 #1 SMP Tue Nov 11 17:57:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
六:查看系统当前时间
[[email protected] /]# date
2015年 01月 14日星期三 13:24:23 CST
[[email protected] /]# clock
2015年01月14日星期三 13时04分08秒 -0.813853 seconds
clock -w #同步系统时间
七:查看硬盘和分区
[[email protected] /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 49G 3.7G 43G 8% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/sda1 93M 67M 22M 76% /boot
/dev/sda5 179G 796M 169G 1% /homefdisk -l
[[email protected] usr]# du –sh #查看当前目录占用空间大小
1.7G .
八:查看系统安装的软件包
cat -n /root/install.log #查看系统默认安装时的软件包
more /root/install.log | wc -l #查看当前系统安装的软件包数量
rpm -qa
rpm -qa | wc -l
yum list installed | wc -l
九:查看selinux是否关闭
sestatus
cat /etc/sysconfig/selinux
十:查看IP地址、网卡mac地址信息
ifconfig
cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep IPADDR
cat /etc/sysconfig/network-scripts/ifcfg-eth0 | ifconfig eth0
[[email protected] usr]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=sky9896
GATEWAY=117.40.239.1
[[email protected] usr]# cat /etc/resolv.conf #查看DNS
nameserver 202.101.224.68
nameserver 8.8.8.8
十一:查看系统默认语言
[[email protected] /]# echo $LANG $LANGUAGE
zh_CN.UTF-8
[[email protected] /]# cat /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
十二:查看所属时区和是否使用UTC时间
[[email protected] /]# cat /etc/sysconfig/clock
ZONE="Asia/Shanghai"
十三:查看主机名
[[email protected] /]# hostname
sky9896
[[email protected] /]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=sky9896
GATEWAY=117.40.239.1
十四:查看系统开机运行时间
[[email protected] /]# uptime
13:06:03 up 18 days, 17:23, 1 user, load average: 0.00, 0.00, 0.00
#此LINUX服务器运行18天了。