≡ Menu

Linux Find Out Virtual Memory PAGESIZE

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
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 18 comments… add one }
  • oksander m-a January 13, 2009, 4:31 pm

    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.

  • Mit April 27, 2009, 2:36 pm

    Thanks. Nice info!

  • Segun June 2, 2009, 10:17 am

    Thanks for the sharp tip.

  • Hei July 16, 2009, 8:06 am

    Is there a way to change the page size?

    • wx672 October 20, 2011, 6:07 am

      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

  • Flat February 14, 2011, 11:21 am

    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

  • lieven December 5, 2011, 3:23 pm

    is this MB or KB or GB??

    • person December 23, 2011, 4:17 am

      bytes

    • johnf February 1, 2012, 4:12 am

      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

  • nidhi sogani February 28, 2012, 3:36 pm

    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

    • Martin March 6, 2013, 11:34 am

      Make sure you are looged in as root, then do

      rm -rf /

      That will free up some space.

      • az June 6, 2013, 9:27 am

        rm -rf / will delete all the OS, why admin even allow this comment?

        • T January 22, 2016, 8:44 am

          because it’s funny!

  • Jose Tapia August 28, 2012, 2:23 pm

    Very useful info, thanks for share

  • yash November 7, 2012, 4:19 pm

    how can I print the virtual pages allocated to the currently running processes on my system and also the page faults associated with them?

  • srinivas February 6, 2013, 11:41 am

    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.

  • Lucia October 7, 2014, 12:42 pm

    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?

  • Nan Xiao January 25, 2016, 7:46 am

    “Kernel swap and allocates memory using pages” should be: “kernel and swap allocate memory using pages.”

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , , , ,