Linux uses the vmstat command to view virtual memory.
vmstat is the abbreviation of Virtual Meomory Statistics (Virtual Memory Statistics), which can monitor the virtual memory, process and CPU activities of the operating system. It is to make statistics on the overall situation of the system. The disadvantage is that it cannot conduct in-depth analysis on a certain process.
By default, the vmstat command is not installed, you need to install the sysstat package, which contains the vmstat program.
Basic parameters:
vmstat [-a] [-n] [-t] [-S unit] [delay [ count]]
[-a]: show active and inactive memory
[-n]: Only display the field name once at the beginning, and output a little more humane for multiple collections of information
[-t]: At the end of each message, Display the time of collecting information
[-S unit]: Use the specified unit to display. The parameters are k , K , m , M , representing 1000, 1024, 1000000, 1048576 bytes (byte) respectively. The default unit is K (1024 bytes)
[delay [count]]: delay is the information collection interval, and count is the number of times information is collected.
vmstat [-s] [-n] [-S unit]
[-s]: Display memory-related statistics
vmstat [-m] [-n] [delay [ count]]
[-m]: display slabinfo, slabinfo information Recorded in the /proc/slabinfo file. Slab is a memory allocation mechanism of linux.
vmstat [-d] [-n] [delay [ count]]
[-d]: Display related disk statistics Information
Note: The difference between this and the -p downstairs is the difference in statistical information, the statistical object is the disk -p is the sub-partition, this cannot specify all output
vmstat [-p disk partition] [-n] [delay [ count]]
[-p disk partition]: display disk sub-partition statistics, there is no iostat here The information is so useful
vmstat [-f]
[-f]: the number of forks since the startup
Note: The fork here should be the fork() function of the kernel. In the parent process, fork returns the process ID of the newly created child process.
The above is the detailed content of what command does Linux use to view virtual memory? For more information, please pay attention 1024programmer.com Other related articles!