Linux系統內查看內核、CPU、內存等的命令總結
一:查看CPU
less /proc/cpuinfo | grep "model name"
(less可以回翻,space翻頁,enter下一行;more不可以回翻,space翻頁,enter下一行)
grep "model name" /proc/cpuinfo
覺得需要看著舒服:grep "model name" /proc/cpuinfo | cut -d: -f2
二:查看內存
free -m |grep "Mem" | awk ‘{print $2}‘
grep MemTotal /proc/meminfo
grep MemTotal /proc/meminfo | cut -d: -f2
三:查看cpu是32位還是64位
uname -a
echo $HOSTTYPE
getconf LONG_BIT
四:查看當前linux的版本
less /etc/system-release
或 cat /etc/redhat-release
或 cat /etc/issue
五:查看內核版本
uname -r
或 uname -a
六:查看當前時間
date
七:查看硬盤和分區
df -h
或 df -hT
查看分區:fdisk -l
查看當前目錄占用的空間:du -sh
查看/etc目錄的大小:du /etc -sh
八:查看安裝的軟件包
查看系統安裝時裝的軟件包:
cat -n /root/install.log
或less /root/install.log | wc -l
查看現在已安裝的軟件包:rpm -qa或 rpm -qa | wc -l
或 yum list installed | wc -l
九:查看鍵盤布局
cat /etc/sysconfig/keyboard
cat /etc/sysconfig/keyboard | grep KEYTABLE | cut -d= -f2
十:查看selinux情況cat /etc/sysconfig/selinux
sestatus
sestatus | cut -d: -f2
十一:查看ip,mac地址
ifconfig
ifconfig eth0 |grep "inet addr:" |awk ‘{print $2}‘|cut -c 6-
ifconfig | grep ‘inet addr:‘| grep -v ‘127.0.0.1‘ | cut -d: -f2 | awk ‘{ print $1}‘
cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep IPADDR
cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep IPADDR | cut -f2 -d=
查看網關:route -n
或 netstat -r
或 ip route show
查看dns:cat /etc/resolv.conf
十二:查看默認語言
echo $LANG $LANGUAGE
cat /etc/sysconfig/i18n
十三:查看所屬時區和是否使用UTC時間
cat /etc/sysconfig/clock
十四:查看主機名
hostname
或 cat /etc/sysconfig/network
常用查詢小結:
1.內核版本:uname -r 或 uname -a
2.內存容量:free -m 或grep MemTotal /proc/meminfo
3.操作系統版本:cat /etc/issue 或者 less /etc/system-release 或cat /etc/redhat-release
4.查看當前用戶名:whoami;查看用戶的UID:id 或 cat /etc/passwd|grep "^root"
5.cpu名稱和內核數:less /proc/cpuinfo | grep "model name"
Linux系統內查看內核、CPU、內存等的命令總結