How to view cpu, memory, hard disk, and other hardware information in linux
Note: in Linux, you can view detailed information about each cpu in/proc/cpuinfo. However, for dual-core CPUs, two CPUs are displayed in cpuinfo. It is often mistaken for two single-core CPUs.
Address: http://www.hpboys.com/659.html
I. linux CPU size
- [Root @ idc ~] # Cat/proc/cpuinfo | grep "model name" & cat/proc/cpuinfo | grep "physical id"
- Model name: Intel (R) Xeon (TM) CPU 2.80 GHz
- Model name: Intel (R) Xeon (TM) CPU 2.80 GHz
- Model name: Intel (R) Xeon (TM) CPU 2.80 GHz
- Model name: Intel (R) Xeon (TM) CPU 2.80 GHz
- Physical id: 0
- Physical id: 0
- Physical id: 3
- Physical id: 3
- [Root @ idc ~] #
In fact, Physical Processor ID should be used to distinguish between single-core and dual-core. Physical Processor ID can be found from cpuinfo or dmesg. flags if ht indicates that the number of physical CPUs can be determined by hyperthreading technology. The value of Physical id can be viewed.
As you can see, this machine has two dual-core CPUs with IDs 0 and 3, respectively, and the size is 2.8 GB.
Ii. Memory size
- [Root @ xbidc ~] # Cat/proc/meminfo | grep MemTotal
- MemTotal: 1034612 kB
- [Root @ xbidc ~] #
Iii. Hard Disk size
- [Root @ xbidc ~] # Fdisk-l | grep Disk
- Disk/dev/sda: 300.0 GB, 300000000000 bytes
- [Root @ xbidc ~] #
4. More methods to view linux hardware information
- Uname-a # linux system information command for viewing kernel/operating system/CPU Information
- Head-n 1/etc/issue # view the operating system version, which is a number 1, not a letter L
- Cat/proc/cpuinfo # linux system information command for viewing CPU Information
- Hostname # linux system information command for viewing computer names
- Lspci-TV # list all PCI devices
- Lsusb-TV # linux system information commands for listing all USB devices
- Lsmod # list loaded Kernel Modules
- Env # view environment variable resources
- Free-m # view memory usage and swap zone usage
- Df-h # view the usage of each partition
- Du-sh # view the size of the specified directory
- Grep MemTotal/proc/meminfo # view total memory
- Grep MemFree/proc/meminfo # view the Amount of idle memory
- Uptime # view system running time, number of users, and load
- Cat/proc/loadavg # view system load disks and partitions
- Mount | column-t # view the status of the mounted Partition
- Fdisk-l # view all partitions
- Swapon-s # view all swap partitions
- Hdparm-I/dev/hda # view disk parameters (only applicable to IDE devices)
- Dmesg | grep IDE # view the network of IDE Device Detection Status at startup
- Ifconfig # view the attributes of all network interfaces
- Iptables-L # view firewall settings
- Route-n # view the route table
- Netstat-lntp # view all listening ports
- Netstat-antp # view all established connections
- Netstat-s # view network statistics process
- Ps-ef # view all processes
- Top # real-time display of Process status users
- W # view active users
- Id # view specified user information
- Last # view User Logon logs
- Cut-d:-f1/etc/passwd # view all users in the system
- Cut-d:-f1/etc/group # view all groups in the system
- Crontab-l # view the scheduled Task Service of the current user
- Chkconfig-list # list all system services
- Chkconfig-list | grep on # list all started system service programs
- Rpm-qa # view all installed software packages
- Cat/proc/cpuinfo: linux system command for viewing CPU-related parameters
- Cat/proc/partitions: Command Used to view linux hard disk and partition information
- Cat/proc/meminfo: linux system command for viewing linux system memory information
- Cat/proc/version: view the version, similar to uname-r
- Cat/proc/ioports: view the device's io port
- Cat/proc/interrupts: view the interrupt
- Cat/proc/pci: View pci device information
- Cat/proc/swaps: View information about all swap partitions