getpagesize - Linux
Overview
getpagesize is a utility that displays the size of a memory page on the system. A memory page is the smallest unit of memory that can be allocated to a process.
Syntax
getpagesize [OPTION]...
Options/Flags
-
-h, –help
Print help and exit. -
-V, –version
Print version and exit.
Examples
To display the size of a memory page in bytes:
getpagesize
To store the size of a memory page in bytes in a variable:
pageSize=$(getpagesize)
Common Issues
None known.
Integration
getpagesize can be used with other commands to manage memory usage. For example, the following command can be used to display the amount of free memory on the system:
free -h | awk '/Mem:/ {printf("Free memory: %.2f GB\n", $4 / 1024 / 1024)}'
Related Commands
- free – Display free and used memory on the system.
- vmstat – Display virtual memory statistics.
- top – Display the top processes using memory.