Q. How do I check the size of PAGESIZE under Linux?
A. Most modern operating systems have their main memory divided into pages. It allows better utilization of memory. A page is a fixed length block of main memory, that is contiguous in both physical memory addressing and virtual memory addressing. Kernel swap and allocates memory using pages
To display size of a page in bytes, enter:
$ getconf PAGESIZE
OR
$ getconf PAGE_SIZE
Output:
4096
🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 18 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Can’t tell you how long I spent searching for this information. I knew it was simple and obvious, but I couldn’t remember it, so I could look it up! So many sites skip the command to get your page size. Points to you for having the info up and easy to parse.
Thanks. Nice info!
Thanks for the sharp tip.
Is there a way to change the page size?
Guess you have to change the kernel source.
In /usr/src/linux/include/asm-generic/page.h you can find the following lines:
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
getconf is nicer for sure, I found the answer on RHEL 5 this way:
man getpagesize
pointed me in this direction:
> cat test.c
#include
#include
int main(void)
{
int sz;
sz=getpagesize();
printf(“Page size: %d\n”,sz);
return 0;
}
> gcc -o test test.c
> ./test
Page size: 4096
is this MB or KB or GB??
bytes
I think it’s the base-2 logarithm of the page size. In other words, 2^PAGE_SHIFT is the page size. 2^12=4096, the usual page size in bytes
on running the calculation in gaussian linux programm i got error again and again….
Probably out of disk space. Write error in NtrExt
i search its meaning on net and found
Solution: /scratch space is most likely full. Delete old files in temporary folder…
please tell me how can do this…
plz
Make sure you are looged in as root, then do
rm -rf /
That will free up some space.
rm -rf / will delete all the OS, why admin even allow this comment?
because it’s funny!
Very useful info, thanks for share
how can I print the virtual pages allocated to the currently running processes on my system and also the page faults associated with them?
Hi,
Most modern operating systems have their main memory divided into pages.
Please correct if i am wong ,
I think the main memory is divided into frames and the virtual memory is divided into pages.
How do i implement a page size change in linux and what effect does it have if i either increase or decrease the page size?
“Kernel swap and allocates memory using pages” should be: “kernel and swap allocate memory using pages.”