bash 如何在 Red Hat Linux Server 中找到 RAM 大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25142492/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 11:02:34  来源:igfitidea点击:

How to find the RAM size in Red Hat Linux Server?

linuxbashshellredhat

提问by Ullan

I am trying to find the command to show the installed memory (RAM) in Red Hat Enterprise Linux Server 6.5.

我试图找到在 Red Hat Enterprise Linux Server 6.5 中显示已安装内存 (RAM) 的命令。

I have found the following command:

我找到了以下命令:

cat /proc/meminfo | grep MemTotal

But it looks like the MemTotal value is not the actual RAM value. I want to know the real RAM of the system (similar to Installed memory(RAM) in Windows).

但看起来 MemTotal 值不是实际的 RAM 值。我想知道系统的真实 RAM(类似于 Windows 中的已安装内存(RAM))。

Thanks for your help.

谢谢你的帮助。

回答by Andrew Stubbs

Try the freecommand, which will tell you the total/used/free amounts of RAM you have, the -mflag will display it in MB:

试试这个free命令,它会告诉你你拥有的 RAM 总量/已用量/可用量,-m标志将以 MB 为单位显示它:

free -m

Though I think it just uses the same source as /proc/meminfobehind the scenes so you may get the same answer.

虽然我认为它只是使用与/proc/meminfo幕后相同的来源,所以你可能会得到相同的答案。