How to Check Memory Usage in Linux
In this article, we are going to explain how to check memory usage in Linux with the help of the command line.
Here is a list of commands for checking memory use in Linux.
Use the grep command to search all log files in /var/log/ location for an out-of-memory error.
grep -i -r ‘out of memory’ /var/log/
2) free -m
Use this command “free” to find the current memory usage in the server.
The command will show you the current “RAM” and “SWAP” usages in MB.
The “sar” command can be used to view the day’s memory consumption history.
4) top -c
Another tool for identifying memory-intensive programs is the “top” command, which allows you to order running processes based on their resource utilization.
You can use the grep command on a cPanel server to check the website access logs for any suspicious/abusive access to the website that is causing this resource exhaustion.
Example: grep -ir “19/Aug/2022:11:20” /usr/local/apache/domlogs/
Some questionable behaviors identified in access logs are as follows:
Specific IP addresses have high access.
High access to previously inaccessible resources/files, etc.
There are a lot of HTTP POST requests.
A large number of failed access attempts, such as login.
Use the command mysqladmin proc stat to find any MySQL queries that have been hanging for a long time and are consuming a lot of memory.
mysqladmin proc stat
Was this article helpful to you? If you continue to have problems with the outlined above, please contact the eTechSupport Team.
January 10, 2023
January 4, 2023
December 22, 2022