linux 查看内存

linux 查看内存
         一、背景
        在使用Linux的过程中,我们经常会遇到查看Linux的内存使用情况。

         二、解决方法
        使用free命令。
        free命令的使用方法如下:
        [root@localhost topsec]# free --help
        Usage:
        free [options]
        Options:
         -b, --bytes         show output in bytes                                    //以字节(byte)的单位显示内存的使用状况
         -k, --kilo          show output in kilobytes                                 //以KB的单位显示内存的使用状况
         -m, --mega          show output in megabytes                        //以M的单位显示内存的使用状况
         -g, --giga          show output in gigabytes                             // 以G的单位显示内存的使用状况
             --tera          show output in terabytes                                //以T的单位显示内存的使用状况
         -h, --human         show human-readable output                  // 以通俗易懂的方式显示内存的使用状况
             --si            use powers of 1000 not 1024                         //以1000 代替1024的刻度显示内存
         -l, --lohi          show detailed low and high memory statistics      //显示最低内存和最高内存
         -t, --total         show total for RAM + swap                                    //显示内存与交换区的和
         -s N, --seconds N   repeat printing every N seconds                 //每隔s 秒运行一次free
         -c N, --count N     repeat printing N times, then exit                   //运行N次并退出
         -w, --wide          wide output                                                       //分开显示
         --help     display this help and exit                                              //显示free命令的使用方法
         -V, --version  output version information and exit                        // 显示free命令的版本
        For more details see free(1).
        [root@localhost topsec]#
        三、例子

        1、查看所有内存,以M的单位显示
        [root@localhost topsec]# free -m
                             total        used        free      shared  buff/cache   available
        Mem:           2832         843        1149          42         840        1729
        Swap:          3071           0        3071
        [root@localhost topsec]#
        其中可以看出内存总量为2832M,已经使用843M。
       
       
        四、其他命令
        top 命令。这里就不说明了,下次吧。






  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值