Linux – Some knowledge you should know

Tram Ho

Let’s take a look at some very familiar knowledge that Linux users should know.

This article revolves around 3 topics: CPU, RAM, DISK


If the computer is a body, the CPU must be the controlling brain, helping the “body” actions to be smooth. Here are some ways to check whether the brain is normal or not ?

Check CPU information

This command will show all the information of the CPU (name, manufacturer, …) in a fairly easy to understand way

We can combine it with the grep command to get some information we want.

  • Check physical processor number – sockets number

  • Check the number of CPU cores on the machine:

=> My computer has 1 CPU, 4 core

  • Check the total number of threads

=> 4 core, 1 thread per core

From there, we have 1 sockets * 4 cores per socket * 1 thread per core = 4 CPU (s)

Check CPU performance

There are many ways to check CPU performance. I usually use the top command

The first line says:

  • The time now is 19:58
  • Server has been turned on for 2 days
  • Number of users currently logged in: 1
  • Average server load in 5/10/15 minutes is 1.38, 1.15, 0.87 respectively, this is quite important and I will talk more specifically below.

Line 2 shows the number of active processes

Line 3: indicates CPU usage status. 16.5 us, 8.3 sy means that the user uses 16.5% and the system uses 8.3%

Next is the information about RAM and SWAP I will talk more specifically in the RAM below

Load avg CPU

There is a remarkable parameter that load avg of CPU temporarily translated as average load or average load of CPU

In the example above, we have an load average: 1,38, 1,15, 0,87 . So understand this figure like?

Load avg can be interpreted as TOTAL average number of processes in the CPU queue. Load avg is usually expressed as a 3-digit form, averaging over 5-10-15 minutes. Here I have 4 meaningful CPUs and load avg in 5 minutes is 1.38. Mean Load avg / 1 CPU is

The higher this number, the more processes the process must wait for the CPU to process. It must be understood that, at one time, 1 cpu can only execute 1 process. Other processes will have to wait until the CPU is idle to be executed. This figure should be distinguished from% of CPU usage.

  • % CPU usage indicates whether a process is using more or less CPU
  • Load avg shows how many processes have to wait for the CPU

Knowing these two numbers will help us evaluate the performance of the CPU and have appropriate solutions. For example, with a shared image storage server, or an LB server, there is no need to process lots of logic, we don’t need a CPU that is too strong but we need a lot of threads to handle many concurrent requests.

For monitoring Load avg of CPU, administrators usually use 0.7 / 1CPU as a landmark. If this threshold is exceeded, it is necessary to monitor and take appropriate measures (increase cpu, increase threading, ..).


Memory and cache

Linux tends to “cache the world” to increase processor speed, RAM is often freed and temporarily stored on disk to use when needed.

This means that when we open a process and turn it off, the system will cache this memory so that when we call the process again, it will immediately use this memory instead of allocating it again. The more processes you open, then turn off, the more cache.

When opening a new process, if the system lacks RAM, Linux will move the cache into SWAP to reserve all the RAM for the process being executed.

So if you want to know if your system is running low on RAM, look at the SWAP index. If the SWAP is high, the device is running low on RAM. A common command to view RAM information is:

Clear the cache server

About memory organization, cache mechanism and some concepts you can read more in this article -kernel

  • Clear the Cache

  • Delete dentries and inodes (slab)

  • Delete PageCache, dentries and inodes.


  • Check Disk status

  • Check the disk partition

Share the news now

Source : Viblo