Check memory usage in linux

angryTom
Release: 2019-10-24 17:54:47
Original
26510 people have browsed it

Check memory usage in linux

linux View memory usage

When optimizing the Linux system, physical memory is the most important aspect. Naturally, Linux also provides many methods to monitor the usage of precious memory resources. The following list details the various methods of viewing memory usage through view tools or command lines under Linux systems.

Recommended: [Linux video tutorial]

1. /proc/meminfo

The easiest way to check RAM usage The method is through /proc/meminfo. This dynamically updated virtual file is actually a combination display of many other memory-related tools (such as: free / ps / top), etc. /proc/meminfo lists all the memory usage you want to know about. The memory usage information of the process can also be viewed through /proc//statm and /proc//status.

$ cat /proc/meminfo
Copy after login

2. atop

The atop command is a terminal environment monitoring command. It shows a combination of various system resources (CPU, memory, network, I/O, kernel) and is color-coded under high load conditions.

$ sudo atop
Copy after login

3. free

The free command is a quick way to view memory usage. It is an overview of the information collected by /proc/meminfo.

$ free -h
Copy after login

4. GNOME System Monitor

GNOME System Monitor is a view tool that displays the usage of CPU, memory, swap area and network in the recent period. It also provides a way to view CPU and memory usage.

$ gnome-system-monitor
Copy after login

5. htop

The htop command displays the real-time memory usage of each process. It provides reports on the resident memory size of all processes, total program memory size, shared library size, etc. The list can be scrolled horizontally and vertically.

$ htop
Copy after login

6. KDE System Monitor

The functions are the same as the GENOME version introduced in 4.

$ ksysguard
Copy after login

7. memstat

memstat is a command that effectively identifies the virtual memory usage of executable(s), process(es) and shared libraries. Given a process ID, memstat can list the executable files, data and shared libraries associated with this process.

$ memstat -p <PID>
Copy after login

8. nmon

nmon is a system benchmark testing tool based on ncurses. It can monitor CPU, memory, I/O, file system and network resources, etc. interactive mode. For memory usage, it can display total/remaining memory, swap space and other information in real time.

$ nmon
Copy after login

9. ps

ps command can display the memory usage of each process in real time. Reported memory usage information includes %MEM (percent of physical memory used), VSZ (total amount of virtual memory used), and RSS (total amount of physical memory used). You can use the "-sort" option to sort processes, for example by RSS:

$ ps aux --sort -rss
Copy after login

10. smem

The smem command allows you to count statistics based on /proc information Memory usage of different processes and users. Analysis of memory usage can export charts (such as bar charts and pie charts).

$ sudo smem --pie name -c "pss"
Copy after login

11. The top

top command provides real-time resource usage statistics of running programs. You can sort based on memory usage and size.

$ top
Copy after login

12. vmstat

The vmstat command displays real-time and average statistics, covering CPU, memory, I/O, etc. For example, memory status not only displays physical memory, but also counts virtual memory.

$ vmstat -s
Copy after login

The above is the detailed content of Check memory usage in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template