#Linux uses the vmstat command to view virtual memory.
vmstat is the abbreviation of Virtual Meomory Statistics, which can monitor the virtual memory, process, and CPU activities of the operating system. It collects statistics on the overall situation of the system. The disadvantage is that it cannot conduct in-depth analysis of 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]: display Active and inactive memory
[-n]: Only display the field name once at the beginning, and output a more humane value for multiple collections of information
[-t]: In each item At the end of the information, the time when the information was collected is displayed
[-S unit]: Display using the specified unit. The parameters are k, K, m, and M, which represent 1000, 1024, 1000000, and 1048576 bytes respectively. The default unit is K (1024 bytes)
[delay [count]]: delay is the information collection interval, and count is the number of information collection times.
vmstat [-s] [-n] [-S unit]
[-s]: Display memory-related statistical information
vmstat [-m] [-n] [delay [ count]]
[-m]: Display slabinfo, which is recorded in the /proc/slabinfo file. Slab is a memory allocation mechanism in Linux.
vmstat [-d] [-n] [delay [ count]]
[-d]: Display statistical information of related disks
Note: This is different from the statistical information of -p downstairs. The statistical object is the disk -p is a subpartition. This cannot specify all output
vmstat [-p disk partition] [-n] [delay [ count]]
[-p disk partition]: Displays the statistical information of disk sub-partitions, which is not as useful as iostat information
vmstat [-f]
[-f]: The statistics since booting Number of forks
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 is used to view virtual memory in Linux?. For more information, please follow other related articles on the PHP Chinese website!