一:查看cpu
more /proc/cpuinfo | grep "model name"
grep "model name" /proc/cpuinfo
如果觉得需要看的更加舒服
grep "model name" /proc/cpuinfo | cut -f2 -d:
怎么样,linux的命令就要这样熟悉。
二:查看内存
[root@CentOS ~]# grep MemTotal /proc/meminfo
[root@CentOS ~]# grep MemTotal /proc/meminfo | cut -f2 -d:
[root@CentOS ~]# free -m |grep "Mem" | awk ‘{print $2}‘
[root@CentOS ~]# free -m
三:查看cpu是32位还是64位
查看CPU位数(32 or 64)
[root@CentOS ~]# getconf LONG_BIT
[[email protected] ~]# echo $HOSTTYPE
[[email protected] ~]# uname -a
四:查看当前linux的版本
[[email protected] ~]# more /etc/redhat-release
[[email protected] ~]# cat /etc/redhat-release
五:查看内核版本
[[email protected] ~]# uname -r
[[email protected] ~]# uname -a
六:查看当前时间
[[email protected] ~]# date
七:查看硬盘和分区
[[email protected] ~]# df -h
[[email protected] ~]# fdisk -l
也可以查看分区
[[email protected] home]# du -sh
可以看到全部占用的空间
[[email protected] home]# du /var/www -sh
可以看到这个目录的大小
八:查看安装的软件包
查看系统安装的时候装的软件包
cat -n /root/install.log
more /root/install.log | wc -l
查看现在已经安装了那些软件包
[[email protected] home]# rpm -qa
.......................
.......................
.......................
.......................
.......................
[[email protected] home]# rpm -qa | wc -l
[[email protected] home]# yum list installed | wc -l
不过很奇怪,我通过rpm,和yum这两种方式查询的安装软件包,数量并不一样。没有找到原因。
九:查看键盘布局
[[email protected] home]# cat /etc/sysconfig/keyboard
[[email protected] home]# cat /etc/sysconfig/keyboard | grep KEYTABLE | cut -f2 -d=
十:查看selinux情况
[[email protected] home]# sestatus
[[email protected] home]# sestatus | cut -f2 -d:
[[email protected] home]# cat /etc/sysconfig/selinux
十一:查看ip,mac地址
在ifcfg-eth0 文件里你可以看到mac,网关等信息。
[[email protected] home]# ifconfig
[[email protected]tOS home]# cat /etc/sysconfig/network-scripts/ifcfg-Auto_eth0
[[email protected] home]# cat /etc/sysconfig/network-scripts/ifcfg-Auto_eth0 | grep IPADDR | cut -f2 -d=
[[email protected] home]# ifconfig eth0 |grep "inet addr:" |awk ‘{print $2}‘|cut -c 6-
[[email protected] home]# ifconfig | grep ‘inet addr:‘| grep -v ‘127.0.0.1‘ | cut -d: -f2 | awk ‘{ print $1}‘
查看网关
[[email protected] home]# cat /etc/sysconfig/network
查看dns
[[email protected] home]# cat /etc/resolv.conf
十二:查看默认语言
[[email protected] home]# echo $LANG $LANGUAGE
[[email protected] home]# cat /etc/sysconfig/i18n
十三:查看所属时区和是否使用UTC时间
[[email protected] /]# cat /etc/sysconfig/clock
十四:查看主机名
[[email protected] /]# hostname
[[email protected] /]# cat /etc/sysconfig/network
修改主机名就是修改这个文件,同时最好也把host文件也修改
CentOS查看系统信息|CentOS查看命令,布布扣,bubuko.com