Linux Find Out Virtual Memory PAGESIZE

Posted on in Categories , , , , , , , last updated January 2, 2008

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

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 18 comments/add one below):

18 comment

  1. 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.

    1. 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

  2. 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

  3. 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

  4. 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.

Leave a Comment