The commands that can be used to check Linux memory usage are listed below.
1) grep
To check for an out-of-memory error, use the grep command to scan through all of the log files in the /var/log/ directory.
grep -i -r 'out of memory' /var/log/
2) free -m
The command "free" can be used to determine the server's current memory usage.
3) sar
The "sar" command can be used to view the daily memory usage history.
sar -r
4) top -c
The "top" command, which gives you the ability to sort the currently running processes depending on their resource utilisation, is another tool to help you identify the memory-consuming processes.