Читать книгу Mastering Linux System Administration - Richard Blum - Страница 18

Real World Scenario LOOKING AT MEMORY

Оглавление

There are a couple of simple commands you can use to get an idea of just how your Linux system is managing memory. While we'll be exploring these commands in more detail later in the book, here's a quick exercise for you to get started exploring your Linux system:

1 Log into your Linux system. (If you don't have a Linux system available yet, you can come back to here after going through either Chapter 2, “Installing an Ubuntu Server,” or Chapter 4, “Installing a Red Hat Server.”)

2 From the command prompt, enter the command free. You should see something similar to this output:$ free total used free shared buff/cache available Mem: 2035504 135668 1449568 1048 450268 1742704 Swap: 2097148 0 2097148The output from the free command shows the total amount of physical memory installed on the system, as well as the amount of swap space currently configured.

3 The free command just provides an overview of the memory for your Linux system. For a more detailed look, enter the command cat /proc/meminfo. You should see a long listing, similar to this:$ cat /proc/meminfo MemTotal: 2035504 kB MemFree: 1449632 kB MemAvailable: 1742352 kB Buffers: 25452 kB Cached: 386028 kB SwapCached: 0 kB Active: 166036 kB Inactive: 290704 kB Active(anon): 51796 kB Inactive(anon): 128 kB Active(file): 114240 kB Inactive(file): 290576 kB Unevictable: 18640 kB Mlocked: 18640 kB SwapTotal: 2097148 kB SwapFree: 2097148 kB Dirty: 156 kB Writeback: 0 kB AnonPages: 63940 kB Mapped: 63344 kB Shmem: 1048 kB KReclaimable: 38664 kB Slab: 74316 kB SReclaimable: 38664 kB SUnreclaim: 35652 kB KernelStack: 2044 kB PageTables: 1268 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 3114900 kB Committed_AS: 376812 kB VmallocTotal: 34359738367 kB VmallocUsed: 27676 kB VmallocChunk: 0 kB Percpu: 516 kB HardwareCorrupted: 0 kB AnonHugePages: 0 kB ShmemHugePages: 0 kB ShmemPmdMapped: 0 kB FileHugePages: 0 kB FilePmdMapped: 0 kB CmaTotal: 0 kB CmaFree: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 0 kB DirectMap4k: 90048 kB DirectMap2M: 2007040 kB $The kernel continually updates the meminfo file to show exactly what's going on in memory at that moment in time, so the file constantly changes.

Mastering Linux System Administration

Подняться наверх