Home  >  Article  >  System Tutorial  >  Find Total CPU and Total Memory Usage of Linux System

Find Total CPU and Total Memory Usage of Linux System

WBOY
WBOYforward
2024-01-05 22:38:411583browse

Today we will introduce the Linux system. Next we will take a look at Linux. To check the total number of CPUs and total memory of the host, you can refer to the following method.

1. Check the total number of cpu

The first method: top command method

First execute the top command, as shown in the figure below.

Find Total CPU and Total Memory Usage of Linux System

In the display interface of the top command, press the numeric key 1, to view the total number of CPUs in the current system, as shown below for a 4-core CPU.

Find Total CPU and Total Memory Usage of Linux System

Method 2: Get the total number of CPUs directly through the proc file system. Specifically execute the following command:

cat /proc/cpuinfo | grep processor

Find Total CPU and Total Memory Usage of Linux System

2. How to check the total memory

Method 1: top command method

top is a very powerful command. You can also use it to total memory, as shown in the figure below.

Find Total CPU and Total Memory Usage of Linux System

Method 2: free command method

The free command is mainly used to display the amount of memory, as shown in the figure below

Find Total CPU and Total Memory Usage of Linux System

Generally use the -h parameter of the free command for a more user-friendly display

Find Total CPU and Total Memory Usage of Linux System

Method 3: Get the total memory directly through the proc virtual file system.

head /proc/meminfo

Find Total CPU and Total Memory Usage of Linux System

This is the method that the editor currently knows about checking the total number of CPUs and total memory of the host in Linux. If new methods are found in the future, we will continue to add them.

related suggestion:

How to configure dual graphics cards in Linux system?

How to check cpu information in Linux system?

How to use commands to view the contents of a specified number of lines in a file in Linux?

The above is the detailed content of Find Total CPU and Total Memory Usage of Linux System. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete