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.
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.80GHzmodel name: Intel(R) Xeon(TM) CPU 2.80GHzmodel name: Intel(R) Xeon(TM) CPU 2.80GHzmodel name: Intel(R) Xeon(TM) CPU 2.80GHzphysical id : 0physical id : 0physical id : 3physical 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 MemTotalMemTotal: 1034612 kB[root@xbidc ~]#[root@xbidc ~]# fdisk -l |grep DiskDisk /dev/sda: 300.0 GB, 300000000000 bytes[root@xbidc ~]#
Uname-a # Command head-n 1/etc/issue for linux to view kernel/operating system/CPU information # command to view the operating system version. The value is 1, not L.
Cat/proc/cpuinfo # linux system information command for viewing CPU information hostname # linux system information command for viewing computer name
Lspci-TV # list all PCI devices lsusb-TV # list linux system information commands for 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 the total memory
Grep MemFree/proc/meminfo # view idle memory volume 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 mounted partitions
Fdisk-l # view all shards swapon-s # view all swap shards
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 properties 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 the active user ID # view the specified user information
Last # view User Logon log cut-d:-f1/etc/passwd # view all users in the system
Cut-d:-f1/etc/group # view all system groups 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 commands for viewing CPU-related parameters
Cat/proc/partitions: Command for viewing linux hard disk and partition information cat/proc/meminfo: Command for viewing linux system memory information
Cat/proc/version: view the version, similar to uname-rcat/proc/ioports: view the device io port
Cat/proc/interrupts: View interrupt cat/proc/pci: View pci device information
Cat/proc/swaps: View information about all swap partitions