Summary of commands in Linux system to view kernel, CPU, memory, etc.

Source: Internet
Author: User

take a look at the CentOS system information as an example
   One: View CPU
less /proc/cpuinfo | grep "model name"
(less can be turned back, Space page, enter the next line; more can not be turned back, Space page, enter the next line)

  grep "model name" /proc/cpuinfo

Feel the need to look comfortable:grep "model name" /proc/cpuinfo | cut -d: -f2

  Two: View memory
  free -m |grep "Mem" | awk ‘{print $2}‘

  grep MemTotal /proc/meminfo

  grep MemTotal /proc/meminfo | cut -d: -f2
Three: Check whether the CPU is 32-bit or 64-bit
  uname -a

  echo $HOSTTYPE

  getconf LONG_BIT

  Four: View the current version of Linux
  less /etc/system-releaseor cat /etc/redhat-release orcat /etc/issue

  V: View kernel version
  uname -rOruname -a

  VI: View current time

  Seven: View hard disks and partitions
  df -hOrdf -hT

To view partitions:fdisk -l

To view the space occupied by the current directory:du -sh

To view the size of the/etc directory:du /etc -sh

  Eight: View the installed packages
To view the system installation Fashion package: cat -n /root/install.log orless /root/install.log | wc -l

To view the packages that are now installed: rpm -qa或 rpm -qa | wc -l oryum list installed | wc -l
  Nine: View the keyboard layout
  cat /etc/sysconfig/keyboard

  cat /etc/sysconfig/keyboard | grep KEYTABLE | cut -d= -f2

  Ten: View selinux status
cat /etc/sysconfig/selinux


  sestatus | cut -d: -f2

  11: View Ip,mac Address

  ifconfig eth0 |grep "inet addr:" |awk ‘{print $2}‘|cut -c 6-

  ifconfig | grep ‘inet addr:‘| grep -v ‘‘ | 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=

View Gateway: route -n or netstat -r orip route show

To view DNS: cat /etc/resolv.conf

  12: View Default language

  cat /etc/sysconfig/i18n

  13: View your time zone and whether to use UTC time
  cat /etc/sysconfig/clock

  14: View Host Name
  hostnameOrcat /etc/sysconfig/network

Common Query Summary:
1. Kernel version: Uname-r or uname-a
2. Memory capacity: Free-m or grep memtotal/proc/meminfo
3. Operating system version: Cat/etc/issue or Less/etc/system-release or cat/etc/redhat-release
4. View current user name: WhoAmI; View the user's Uid:id or cat/etc/passwd|grep "^root"
5.CPU name and number of cores: Less/proc/cpuinfo | grep "model name"

Summary of commands in Linux system to view kernel, CPU, memory, etc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.