Linux Find Out Virtual Memory PAGESIZE

Q. How do I check the size of PAGESIZE under Linux?

ADVERTISEMENTS

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
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
18 comments… add one
  • oksander m-a Jan 13, 2009 @ 16:31

    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 Apr 27, 2009 @ 14:36

    Thanks. Nice info!

  • Segun Jun 2, 2009 @ 10:17

    Thanks for the sharp tip.

  • Hei Jul 16, 2009 @ 8:06

    Is there a way to change the page size?

    • wx672 Oct 20, 2011 @ 6:07

      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 Feb 14, 2011 @ 11:21

    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 Dec 5, 2011 @ 15:23

    is this MB or KB or GB??

    • person Dec 23, 2011 @ 4:17

      bytes

    • johnf Feb 1, 2012 @ 4:12

      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 Feb 28, 2012 @ 15:36

    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 Mar 6, 2013 @ 11:34

      Make sure you are looged in as root, then do

      rm -rf /

      That will free up some space.

      • az Jun 6, 2013 @ 9:27

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

        • T Jan 22, 2016 @ 8:44

          because it’s funny!

  • Jose Tapia Aug 28, 2012 @ 14:23

    Very useful info, thanks for share

  • yash Nov 7, 2012 @ 16:19

    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 Feb 6, 2013 @ 11:41

    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 Oct 7, 2014 @ 12:42

    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 Jan 25, 2016 @ 7:46

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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.