终端查看linux硬盘内存_如何从Linux终端检查内存使用情况

本文介绍了如何在Linux终端中使用free、vmstat和top命令来检查内存使用情况。Linux将未使用的RAM用于提高系统性能,通过这些命令可以了解总内存、已使用、空闲、缓冲区/缓存等信息,以及交换空间的使用状态,帮助用户监控和优化系统资源。
摘要由CSDN通过智能技术生成
终端查看linux硬盘内存

终端查看linux硬盘内存

A terminal window on an Ubuntu-style Linux system.
Fatmawati Achmad Zaenuri/Shutterstock Fatmawati Achmad Zaenuri / Shutterstock

There are plenty of ways you can get the lowdown on memory usage within your Linux system. In this roundup, we’ll cover the most commonly used command-line methods: free, vmstat, and top. We’ll also look at reading /proc/meminfo directly.

有很多方法可以降低Linux系统中的内存使用率。 在本综述中,我们将介绍最常用的命令行方法: freevmstattop 。 我们还将看直接阅读/proc/meminfo

Linux如何使用RAM (How Linux Uses RAM)

RAM is a finite resource that all processes, like applications and daemons, want a piece of. There’s only so much of it available. The kernel referees the memory squabbles and allocates the rationed memory out to all the hungry processes. It’s kind of like a mother bird with more open beaks pointed at her than she has the grub for.

RAM是所有进程(例如应用程序和守护程序)都需要的有限资源。 只有这么多可用。 内核引用内存争用并将分配的内存分配给所有饥饿的进程。 这就好比是一只母鸟,嘴巴指向她的鸟嘴多于she。

Unused RAM is wasted RAM. Linux uses any spare RAM for things like file buffer space, to keep your computer running at optimum performance. It’s easy to get the impression that your system’s RAM has been consumed by some runaway process or memory leak, but that’s rarely the case.

未使用的RAM浪费了RAM。 Linux使用任何备用RAM 作为文件缓冲区空间之类的东西 ,以保持计算机以最佳性能运行。 很容易让人感觉到系统的RAM已被一些失控的进程或内存泄漏所消耗,但这种情况很少见。

It’s usually just the kernel tenaciously doing its job in the background. If there are other demands for the RAM that the kernel has poached for its own devices, it relinquishes the memory instantly, so there’s no harm done.

通常只是内核在后台顽强地完成其工作。 如果内核为自己的设备挖走了对RAM的其他要求,它会立即放弃内存,因此不会造成任何危害。

If the kernel decides it’s more efficient to start using swap space, it brings that into play, as well. There’s a lot of confusion about the swappiness value in Linux and when the kernel will start using swap. It’s untrue that the swappiness value sets a threshold for RAM usage that triggers swap to be enabled.

如果内核决定开始使用交换空间会更有效,那么它也会发挥作用。 关于Linux中的swappiness以及内核何时开始使用swap,存在很多困惑。 swappiness值设置用于触发启用交换的RAM使用阈值是不正确的。

But now, let’s look at the different techniques you can use in the terminal window to see the RAM usage on your Linux computer.

但是现在,让我们看一下可以在终端窗口中使用的不同技术,以查看Linux计算机上的RAM使用情况。

自由命令 (The free Command)

The free command gives you a table of the total, used, free, shared, buffer/cache, and available RAM on your computer. It also shows you the total amount of swap space configured, and how much is used and available.

free命令为您提供计算机上已使用,可用,可用,共享,缓冲区/缓存和可用RAM总数的表。 它还显示配置的交换空间的总量,以及已使用和可用的空间。

In our example, we’ll use the -m (mebibytes) option. However, you could also use -b (bytes), -k (kibibytes), or -g (gibibytes).

在我们的示例中,我们将使用-m (兆字节)选项。 但是,您也可以使用-b (字节),- -k (千字节)或-g (千兆字节)。

We type the following command:

我们输入以下命令:

free -m
The "free -m" command in a terminal window.

This is the output we get:

这是我们得到的输出:

      total used free shared buff/cache available
Mem:   1987  901   95     80        990       811
Swap: 1521   651  869

The Mem columns contain the following information:

Mem列包含以下信息:

  • Total: The total amount of physical RAM on this computer.

    总计 :此计算机上的物理RAM总量。

  • Used: The sum of Free+Buffers+Cache subtracted from the total amount.

    已用 :从总数中减去Free + Buffers + Cache的总和。

  • Free: The amount of unused memory.

    可用 :未使用的内存量。

  • Shared: Amount of memory used by the tmpfs file systems.

    共享的tmpfs文件系统使用的内存量。

  • Buff/cache: Amount of memory used for buffers and cache. This can be released quickly by the kernel if required.

    Buff / cache :用于缓冲区和缓存的内存量。 如果需要,内核可以快速释放它。

  • Available: This is an estimate of the memory that’s available to service memory requests from applications and any other operational software on your computer.

    可用 :这是可用于处理来自应用程序和计算机上其他任何运行软件的内存请求的内存的估计值。

The Swap columns contain the following information:

Swap列包含以下信息:

  • Total: The size of the swap partition or file.

    总计 :交换分区或文件的大小。

  • Used: The amount of swap space that’s in use.

    已用 :正在使用的交换空间量。

  • Free: The amount of remaining (unused) swap space.

    Free :剩余(未使用)的交换空间量。

You can also use the following nifty trick we tweaked from one of our readers to see the percentage of swap space that is used:

您还可以使用我们从其中一位读者调整的以下巧妙技巧来查看所用交换空间的百分比:

free -m | grep Swap | awk '{print ($3/$2)*100}'
The "free -m | grep Swap | awk '{print ($3/$2)*100}'" command in a terminal window.

vmstat命令 (The vmstat Command)

It’s impossible to have a good understanding of the way RAM is used in your Linux box without an appreciation of the state of your swap space. RAM and swap space work closely together.

如果不了解交换空间的状态,就不可能对Linux机器中RAM的使用方式有充分的了解。 RAM和交换空间紧密协作。

You can use the vmstat command to take a deeper dive into how your swap space (or virtual memory) is being used. It gives you a report on a variety of swap-related statistics based on the average values since the last reboot.

您可以使用vmstat命令更深入地了解交换空间(或虚拟内存)的使用方式。 它根据自上次重新启动以来的平均值为您提供各种与交换有关的统计信息的报告。

Type the following:

输入以下内容:

vmstat
The "vmstat" command in a terminal window.

This is the output without the wrap-around:

这是没有回绕的输出:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b    swpd    free  buff   cache   si  so    bi   bo    in   cs  us sy id wa st
3 0  671488  576084  51088  823876   1   7    53   62    99   14   4  1 95  0  0

There are a lot of data points in that report, so we’ll break them down:

该报告中有很多数据点,因此我们将其分解:

  • Proc:

    程序:

    • r: The number of “runnable” processes. They’re either running or waiting for their next time-sliced burst of CPU cycles.

      r :“可运行”进程的数量。 他们正在运行或正在等待下一个时间片状的CPU周期突发。

    • b: The number of processes in uninterruptible sleep. These aren’t sleeping, but performing a blocking system call. They can’t be interrupted until they complete their current action. Typically, this process is a device driver waiting for some resource to be free. Any queued interrupts for that process are handled when the process resumes its usual activity.

      b :不间断睡眠的进程数。 这些不是在睡觉,而是在执行阻塞的系统调用。 在完成当前操作之前,不能中断它们。 通常,此过程是一个设备驱动程序,等待某些资源可用。 当该进程恢复其正常活动时,将处理该进程的所有排队中断。

    Proc:

    程序:

  • Memory:

    记忆:

    • swpd: The amount of virtual memory used, i.e., how much memory has been swapped out.

      swpd :使用的虚拟内存量,即已换出多少内存。

    • free: The amount of idle (unused) memory.

      free :空闲(未使用)的内存量。

    • buff: The amount of memory used as buffers.

      buff :用作缓冲区的内存量。

    • cache: The amount of memory used as cache.

      cache :用作缓存的内存量。

    Memory:

    记忆:

  • Swap:

    交换:

    • si: The amount of virtual memory swapped in from swap space.

      si :从交换空间交换的虚拟内存量。

    • so: The amount of virtual memory swapped out to swap space.

      so :交换出交换空间的虚拟内存量。

    Swap:

    交换:

  • IO:

    IO:

    • bi: Blocks in. The number of data blocks used to swap virtual memory back to RAM.

      bi :块中。用于将虚拟内存交换回RAM的数据块数。

    • bo: Blocks out. The number of data blocks used to swap virtual memory out of RAM and into swap space.

      bo :封锁。 用于将虚拟内存交换出RAM并交换空间的数据块数。

    IO:

    IO:

  • System:

    系统:

    • in: The number of interrupts per second, including the clock.

      in :每秒的中断数,包括时钟。

    • cs: The number of context switches per second. A context switch is when the kernel swaps from system to user mode processing.

      cs :每秒上下文切换数。 上下文切换是指内核从系统切换到用户模式处理时。

    System:

    系统:

  • CPU: These values are all percentages of the total CPU time:

    CPU:这些值都是总CPU时间的百分比:

    • us: Time spent running user (non-kernel) code.

      us :运行用户(非内核)代码所花费的时间。

    • sy: Time spent running kernel code.

      sy :运行内核代码所花费的时间。

    • id: Time spent idle.

      id :空闲时间。

    • wa: Time spent waiting for in- or output.

      wa :等待输入或输出所花费的时间。

    • st: The time a virtual machine has to wait for the hypervisor to finish servicing other virtual machines before it can come back and attend to this virtual machine.

      st :虚拟机必须等待系统管理程序完成对其他虚拟机的服务,然后虚拟机才能返回并参与该虚拟机。

    CPU: These values are all percentages of the total CPU time:

    CPU:这些值都是总CPU时间的百分比:

最高司令部 (The top Command)

The top command displays a screen packed with information. The values are updated every few seconds.

top命令显示一个包含信息的屏幕。 值每隔几秒钟更新一次。

To use it, we type the following:

要使用它,我们输入以下内容:

top
The "top" command in a terminal window.

The “e” key was pressed. This changed the display to megabytes, which are easier to visually parse than long strings representing bytes. There are five lines of information at the top of the screen and a lower pane with columns of data.

按下“ e”键。 这将显示更改为兆字节,这比代表字节的长字符串更易于视觉解析。 屏幕顶部有五行信息,下部窗格中有数据列。

Here’s the info you’ll find on each line:

这是您在每一行上都能找到的信息:

  • Line one: The time, how long the computer has been running, how many people are logged in, and what the load average has been over the past one, five, and 15 minutes.

    第一行:时间,计算机运行了多长时间,登录了多少人以及过去一分钟,五分钟和15分钟的平均负载量是多少。

  • Line two: The number of tasks and their states: running, stopped, sleeping, or zombie.

    第二行:任务的数量及其状态:正在运行,已停止,正在睡眠或僵尸。

  • Line three: CPU information (see the breakdown of the fields below).

    第三行: CPU信息(请参阅以下字段的细分)。

  • Line four: The total amount of physical memory, and how much is free, used, buffered, or cached.

    第四行:物理内存的总量,以及空闲,已使用,已缓冲或已缓存的内存量。

  • Line five: Total amount of swap memory, and how much is free, used and available (taking into account memory that’s expected to be recoverable from caches).

    第五行:交换内存的总量,以及空闲,已使用和可用的内存量(考虑到预期可以从缓存中恢复的内存)。

The CPU fields on line three are as follows:

第三行的CPU字段如下:

  • us: Time the CPU spends executing processes for users in user space.

    us: CPU在用户空间中为用户执行进程所花费的时间。

  • sy: Time the CPU spent running system “kernel space” processes.

    sy: CPU花在运行系统“内核空间”进程上的时间。

  • ni: Time the CPU spent executing processes with a manually set nice value.

    ni:使用手动设置的nice值花费CPU执行进程的时间。

  • id: CPU idle time.

    id: CPU空闲时间。

  • wa: Time the CPU spends waiting for I/O to complete.

    wa: CPU等待I / O完成所花费的时间。

  • hi: Time the CPU spent servicing hardware interrupts.

    嗨: CPU花费在服务硬件中断上的时间。

  • si: Time the CPU spent servicing software interrupts.

    si: CPU用于服务软件中断的时间。

  • st (steal time): Time the CPU lost due to running virtual machines.

    st(窃取时间): CPU由于运行虚拟机而丢失的时间。

You might have to press the left or right arrow keys to see all the columns. The values in each column are described below:

您可能必须按向左或向右箭头键才能查看所有列。 每列中的值如下所述:

  • PID: Process ID.

    PID:进程ID。

  • USER: Name of the owner of the process.

    USER:进程所有者的名称。

  • PR: Process priority.

    PR:流程优先级。

  • NI: The nice value of the process.

    NI:这个过程很有价值。

  • VIRT: Virtual memory used by the process.

    VIRT:进程使用的虚拟内存。

  • RES: Resident memory used by the process.

    RES:进程使用的常驻内存。

  • SHR: Shared memory used by the process.

    SHR:进程使用的共享内存。

  • S: Status of the process. (See the list of values this field can take below).

    S:进程状态。 (请参阅下面的此字段取值列表)。

  • %CPU: The share of CPU time used by the process since the last update.

    %CPU:自上次更新以来进程使用的CPU时间的份额。

  • %MEM: The share of physical memory used.

    %MEM:使用的物理内存份额。

  • TIME+: Total CPU time used by the task in 100ths of a second.

    TIME +:任务使用的总CPU时间,以百分之一秒为单位。

  • COMMAND: The Command name or line (name + options). (This column is offscreen to the right in the image above.)

    COMMAND:命令名称或行(名称+选项)。 (此列在上图中的屏幕右边)。

The status displayed in the S column can be one of the following:

S列中显示的状态可以是以下之一:

  • D: Uninterruptible sleep.

    D:不间断的睡眠。

  • R: Running.

    R:跑步。

  • S: Sleeping.

    S:睡觉。

  • T: Traced (stopped).

    T:已追踪(已停止)。

  • Z: Zombie.

    Z:僵尸。

Press Q to exit top.

按Q退出top

阅读/ proc / meminfo (Reading /proc/meminfo)

Many (and, quite likely, most) of the tools in Linux that report memory statistics retrieve their information from the pseudo filesystem /proc/meminfo. We can use the cat or less commands to do the same.

Linux中许多(而且很可能是大多数)报告内存统计信息的工具都从伪文件系统 /proc/meminfo 检索其信息 。 我们可以使用catless命令来执行相同的操作。

We type the following:

我们输入以下内容:

less /proc/meminfo
The "less /proc/meminfo" command in a terminal window.

You might see different fields depending on the kernel that’s running, and the architecture of the CPU. We got the following results on our virtual machine:

您可能会看到不同的字段,具体取决于正在运行的内核以及CPU的体系结构。 我们在虚拟机上获得了以下结果:

MemTotal:          2035260 kB
MemFree:            919064 kB
MemAvailable:      1300932 kB
Buffers:             33528 kB
Cached:             457604 kB
SwapCached:          29732 kB
Active:             313360 kB
Inactive:           603276 kB
Active(anon):        74648 kB
Inactive(anon):     355004 kB
Active(file):       238712 kB
Inactive(file):     248272 kB
Unevictable:            16 kB
Mlocked:                16 kB
SwapTotal:         1557568 kB
SwapFree:           873024 kB
Dirty:                  80 kB
Writeback:               0 kB
AnonPages:          414100 kB
Mapped:              97436 kB
Shmem:                4148 kB
KReclaimable:        52932 kB
Slab:                94216 kB
SReclaimable:        52932 kB
SUnreclaim:          41284 kB
KernelStack:          9280 kB
PageTables:          45264 kB
NFS_Unstable:            0 kB
Bounce:                  0 kB
WritebackTmp:            0 kB
CommitLimit:       2575196 kB
Committed_AS:      5072192 kB
VmallocTotal:  34359738367 kB
VmallocUsed:         35712 kB
VmallocChunk:            0 kB
Percpu:                720 kB
HardwareCorrupted:       0 kB
AnonHugePages:           0 kB
ShmemHugePages:          0 kB
ShmemPmdMapped:          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:        180160 kB
DirectMap2M:       1916928 kB

All sizes are in kibibytes unless otherwise indicated. Here’s what they all mean, along with some others you might see depending on your computer’s configuration and hardware:

除非另有说明,否则所有大小均以kb为单位。 这就是它们的意思,以及根据计算机的配置和硬件可能会看到的其他一些含义:

  • MemTotal: Total usable RAM (apart from a few reserved bits and the kernel binary code).

    MemTotal:总可用RAM(除了一些保留位和内核二进制代码)。

  • MemFree: The sum of LowFree+HighFree. The amount of RAM currently available.

    MemFree: LowFree + HighFree的总和。 当前可用的RAM量。

  • MemAvailable: Estimated memory available to start new applications, without swapping.

    MemAvailable:估计的内存可用于启动新应用程序,而无需交换。

  • Buffers: Temporary storage for raw disk blocks. This reduces hard drive in- and output. It also speeds up access to subsequent requests for the same data because it’s already in memory.

    缓冲区:原始磁盘块的临时存储。 这减少了硬盘驱动器的输入和输出。 由于它已经在内存中,因此还可以加快对后续对相同数据的请求的访问。

  • Cached: Cached pages read from files on the hard drive (not including SwapCached).

    缓存:从硬盘上的文件读取的缓存页面(不包括SwapCached )。

  • SwapCached: Memory that was swapped out and back in, and a copy remains in the swap space.

    SwapCached:交换出并重新插入的内存,并且副本保留在交换空间中。

  • Active: Memory used recently. It’s not reclaimed unless absolutely necessary.

    活动:最近使用的内存。 除非绝对必要,否则不会将其回收。

  • Inactive: Memory that’s been used, but not the most recently used. It’s a likely candidate for reclamation.

    非活动状态:已使用但不是最近使用的内存。 它可能是填海的候选者。

  • Active(anon): Memory allocated to files created in a tmpfs pseudo-file system. Anonymous files don’t reside on the hard drive.

    活动(匿名):分配给在tmpfs伪文件系统中创建的文件的内存。 匿名文件不驻留在硬盘驱动器上。

  • Inactive(anon): Amount of anonymous, tmpfs, and shmem memory that’s a candidate for eviction (memory reclamation).

    不活动(匿名):大量的匿名, tmpfsshmem内存可以驱逐(内存回收)。

  • Active(file): Amount of file cache memory in use, or that has been used since the previous memory reclamation cycle.

    活动(文件):正在使用或自上一个内存回收周期以来已使用的文件高速缓存内存量。

  • Inactive(file): Amount of file cache memory read from a hard drive that is a candidate for reclaiming.

    不活动(文件):从硬盘驱动器读取的文件缓存内存量,可以作为回收对象。

  • Unevictable: Amount of memory that should be evictable, but isn’t because it’s locked into memory by user-space processes.

    无法撤消:应该撤出的内存量,但这不是因为用户空间进程将其锁定在内存中。

  • Mlocked: Total amount of memory not evictable because it’s locked by user-space processes.

    Mlocked:不可撤消的内存总量,因为它已被用户空间进程锁定。

  • HighTotal: Total amount of HighMem, which is used by user-space programs and page cache. The kernel can access this memory zone, but it’s slower for it to access than LowMem.

    HighTotal: HighMem的总量,由用户空间程序和页面缓存使用。 内核可以访问该内存区域,但访问速度比LowMem慢。

  • HighFree: Amount of free HighMem.

    HighFree:免费的HighMem数量。

  • LowTotal: Amount of LowMem, which is available for all the same uses as HighMem, but also for the kernel to use for its own purposes.

    LowTotal:LowMem的数量,可用于与HighMem相同的所有用途,也可用于内核用于其自身目的。

  • LowFree: Amount of free LowMem.

    LowFree:免费的LowMem数量。

  • MmapCopy: Amount of memory that’s been mapped to file data.

    MmapCopy:已映射到文件数据的内存量。

  • SwapTotal: Total amount of swap space available.

    SwapTotal:可用交换空间的总量。

  • SwapFree: Amount of swap space that’s currently unused.

    SwapFree:当前未使用的交换空间量。

  • Dirty: Amount of memory waiting to be written back to the disk.

    脏:等待写回磁盘的内存量。

  • Writeback: Memory actively being written back to the disk.

    回写:主动将内存写回到磁盘。

  • AnonPages: Non-file backed pages mapped into user-space page tables.

    AnonPages:非文件支持的页面映射到用户空间页面表中。

  • Mapped: Files (like libraries) that are mapped into memory.

    映射的:映射到内存中的文件(如库)。

  • Shmem: Amount of memory consumed in tmpfs pseudo-file systems.

    Shmem: tmpfs伪文件系统中消耗的内存量。

  • KReclaimable: Kernel memory allocations the kernel will attempt to reclaim if the demand for memory is severe enough.

    KReclaimable:如果对内存的需求足够严格,内核将尝试回收内核内存。

  • Slab: In-kernel data structures cache.

    Slab:内核中的数据结构缓存。

  • SReclaimable: Amount of Slab memory that might be reclaimed, such as caches.

    SReclaimable:可回收Slab内存量,例如缓存。

  • SUnreclaim: Amount of Slab memory that can’t be reclaimed.

    SUnreclaim:无法回收的Slab内存量。

  • KernelStack: Amount of memory allocated to kernel stacks.

    KernelStack:分配给内核堆栈的内存量。

  • PageTables: Amount of memory dedicated to the lowest level of page tables.

    PageTables:专用于最低级别的页表的内存量。

  • Quicklists: Because the allocation and deletion of page tables is a very frequent operation, it’s vital that’s it’s as quick as possible. So, the pages used for page tables are cached in a number of different lists called “quicklists.”

    快速列表:由于页表的分配和删除是一项非常频繁的操作,因此至关重要的是要尽可能快。 因此,用于页表的页被缓存在许多不同的列表中,这些列表称为“快速列表”。

  • NFS_Unstable: Network File System (NFS) pages the server has received, but not yet written to non-volatile storage.

    NFS_Unstable:服务器已接收但尚未写入非易失性存储的网络文件系统 (NFS)页面。

  • Bounce: Memory used for block device bounce buffers. A bounce buffer is positioned in memory low enough for a device to directly access it. The data is then copied to the desired user page in HighMem.

    反弹:用于块设备反弹缓冲区的内存。 反弹缓冲区位于内存中的位置足够低,足以使设备直接访问它。 然后将数据复制到HighMem中所需的用户页面。

  • WritebackTmp: Memory used by Filesystem in Userspace (FUSE) for temporary write-back buffers.

    WritebackTmp: 文件系统在用户空间 (FUSE)中用于临时写回缓冲区的内存。

  • CommitLimit: The total amount of memory currently available to be allocated in the system.

    CommitLimit:当前可在系统中分配的内存总量。

  • Committed_AS: The amount of memory estimated to satisfy all current demands. If a program requests some RAM, the request is recorded, but the RAM is only allocated once the program starts to use it. It’s also only allocated as required, up to the maximum amount the program reserved. More memory can be “allocated” than can actually be delivered. If all programs try to cash in their RAM chips at once, the memory casino might go bust (and have to go cap in hand to the swap-space financiers).

    Committed_AS:为满足所有当前需求而估计的内存量。 如果程序请求一些RAM,则会记录该请求,但是仅在程序开始使用RAM时才分配该RAM。 它也仅根据需要分配,最多为程序保留的数量。 “分配”的内存可能比实际交付的内存更多。 如果所有程序都试图立即兑现其RAM芯片,则存储娱乐场可能会破产(必须与交换空间金融家并驾齐驱)。

  • VmallocTotal: Total size of the vmalloc memory area.

    VmallocTotal: vmalloc内存区域的总大小。

  • VmallocUsed: Amount of vmalloc area used. Since Linux 4.4, this field is no longer calculated, it’s hard-coded.

    VmallocUsed:使用的vmalloc区域数量。 从Linux 4.4开始,不再计算该字段,而是对其进行硬编码。

  • VmallocChunk: Largest contiguous block of free vmalloc area.

    VmallocChunk:空闲vmalloc区域的最大连续块。

  • HardwareCorrupted: Amount of memory tagged as having physical memory corruption problems. It won’t be allocated.

    HardwareCorrupted:标记为存在物理内存损坏问题的内存量。 它不会被分配。

  • LazyFree: Amount of memory in MADV_FREE state. When an application sets the MADV_FREE flag on a range of pages, this indicates it no longer requires them, and they’re now reclamation candidates. Actual reclamation might be delayed until there’s sufficient demand for memory. If the application starts to write to pages, the reclamation can be canceled.

    LazyFree:处于MADV_FREE状态的内存量。 当应用程序在一系列页面上设置MADV_FREE标志时, 表明它不再需要它们 ,并且它们现在是回收的候选对象。 实际的回收可能会延迟,直到有足够的内存需求为止。 如果应用程序开始写入页面,则可以取消回收。

  • AnonHugePages: Non-file backed huge pages mapped into user-space page tables. Non-file backed pages didn’t come from a hard drive file.

    AnonHugePages:非文件支持的大页面映射到用户空间页面表中。 非文件支持的页面不是来自硬盘文件。

  • ShmemHugePages: Amount of memory used by shared memory (shmem) and pseudo-file systems (tmpfs) allocated with huge pages.

    ShmemHugePages:分配有大页面的共享内存( shmem )和伪文件系统( tmpfs )使用的内存量。

  • ShmemPmdMapped: Amount of shared memory mapped into user-space with huge pages.

    ShmemPmdMapped:映射到具有大页面的用户空间的共享内存量。

  • CmaTotal: Amount of CMA (Contiguous Memory Allocator) pages. These are used by devices that can only communicate to contiguous regions of memory.

    CmaTotal: CMA(连续内存分配器)页面的数量。 这些只能由只能与内存连续区域通信的设备使用。

  • CmaFree: Amount of free CMA (Contiguous Memory Allocator) pages.

    CmaFree:空闲CMA(连续内存分配器)页面的数量。

  • HugePages_Total: Huge page pool size.

    HugePages_Total:巨大的页面池大小。

  • HugePages_Free: Number of unallocated huge pages in the pool.

    HugePages_Free:池中未分配的大页面数。

  • HugePages_Rsvd: Number of reserved huge pages. The commitment to allocate has been made, but allocation hasn’t occurred yet.

    HugePages_Rsvd:保留的大页面数。 已经做出分配的承诺,但尚未发生分配。

  • HugePages_Surp: Number of huge pages in the pool above the defined system value.

    HugePages_Surp:池中已定义系统值以上的大页面数。

  • Hugepagesize: Size of huge pages.

    Hugepagesize:大页面的大小。

  • DirectMap4k: Number of bytes of RAM mapped to 4 kB pages.

    DirectMap4k:映射到4 kB页的RAM的字节数。

  • DirectMap4M: Number of bytes of RAM mapped to 4 MB pages.

    DirectMap4M:映射到4 MB页面的RAM字节数。

  • DirectMap2M: Number of bytes of RAM mapped to 2 MB pages.

    DirectMap2M:映射到2 MB页面的RAM字节数。

  • DirectMap1G: Number of bytes of RAM mapped to 2 GB pages.

    DirectMap1G:映射到2 GB页面的RAM的字节数。



As usual with Linux, there’s more than one way to get a quick overview, and always at least one way to go deeper into the details.

与Linux一样,有多种方法可以使您快速获得概述,并且至少总是有一种方法可以更深入地了解细节。

You’ll probably use free, top, and vmstate regularly, and keep /proc/meminfo in reserve for when you need to do a deep-dive to investigate a particular issue.

您可能会定期使用freetopvmstate ,并在需要深入研究特定问题时保留/proc/meminfo

翻译自: https://www.howtogeek.com/659529/how-to-check-memory-usage-from-the-linux-terminal/

终端查看linux硬盘内存

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值