日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

centos 没有nmtui命令_Linux free 命令

發布時間:2023/12/10 linux 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos 没有nmtui命令_Linux free 命令 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在Linux/Unix 系統上,free是一個很受系統管理員歡迎的命令,它是一個功能強大的工具,他能以一種易讀的方式把內存使用情況展示出來

free 展示了系統中空閑和已經使用了的物理內存、交換內存以及內核的緩沖區和頁面緩存,所有展示的信息都是從 /proc/meminfo 文件解析出來的

語法

free命令的語法如下

free [options]

輸出列說明

當只輸入free?命令不帶任何選項時,輸出的內存和交換內存大小是以 KB(kbytes)為單位的,具體的輸出如下所示(在舊版的Linux系統中,顯示可能略有不同):

[root@ecs-centos-7 ~]# free
total used free shared buff/cache available
Mem: 1881544 325980 1307868 8712 247696 1406892
Swap: 0 0 0
  • total

總內存的大小,可以用于應用程序的內存

  • used

已經使用內存,計算方式是:used = total - free - buff/cache

  • free

還沒有使用的內存

  • shared

進程之間的共享內存

  • buff/cache

內核緩沖區和頁面緩存,如果應用程序需要的話,可以隨時回收這部分緩存,通過?free -w?命令可以分別顯示 buff 和 cache 占用的內存

  • available

可用內存的預估大小,可以用于啟動新的應用程序,實際應用中,可以把 free 和 buff/cache 加起來看做 available 的近似值,即 free + buff/cache ≈ available

常用的選項

以下是一些常用的選項

  • 以易讀的方式顯示

[root@ecs-centos-7 ~]# free -h
total used free shared buffers cache available
Mem: 1881544 353752 881684 8712 147960 498148 1370492
Swap: 0 0 0
  • 顯示物理內存和交換內存的總和

[root@ecs-centos-7 ~]# free -t
total used free shared buff/cache available
Mem: 1881544 354108 881328 8712 646108 1370136
Swap: 0 0 0
Total: 1881544 354108 881328
  • 每隔N秒輸出一次

[root@ecs-centos-7 ~]# free -s 2
total used free shared buff/cache available
Mem: 1881544 353960 881476 8712 646108 1370284
Swap: 0 0 0

total used free shared buff/cache available
Mem: 1881544 353984 881452 8712 646108 1370260
Swap: 0 0 0

total used free shared buff/cache available
Mem: 1881544 353984 881452 8712 646108 1370260
Swap: 0 0 0

例子中的命令是每隔2秒輸出一次內存信息,直到按?Ctrl + Z?停止

  • 重復輸出N次

[root@ecs-centos-7 ~]# free -c 3
total used free shared buff/cache available
Mem: 1881544 353960 881476 8712 646108 1370284
Swap: 0 0 0

total used free shared buff/cache available
Mem: 1881544 353984 881452 8712 646108 1370260
Swap: 0 0 0

total used free shared buff/cache available
Mem: 1881544 353984 881452 8712 646108 1370260
Swap: 0 0 0

上面的例子是重復輸出內存信息3次,每次間隔默認是1秒,如果要修改默認輸出間隔可以加上?-s 秒數,下面的命令是:重復輸出3次,每次輸出間隔2秒

free -c 3 -s 2
  • buff 和 cache 分開顯示

[root@ecs-centos-7 ~]# free -w
total used free shared buffers cache available
Mem: 1881544 354100 881328 8712 147968 498148 1370144
Swap: 0 0 0
  • 以 Bytes、KB、MB、GB 為單位輸出

[root@ecs-centos-7 ~]# free -b
total used free shared buff/cache available
Mem: 1926701056 362446848 902631424 8921088 661622784 1403179008
Swap: 0 0 0
[root@ecs-centos-7 ~]# free -k
total used free shared buff/cache available
Mem: 1881544 354100 881328 8712 646116 1370144
Swap: 0 0 0
[root@ecs-centos-7 ~]# free -m
total used free shared buff/cache available
Mem: 1837 345 860 8 630 1338
Swap: 0 0 0
[root@ecs-centos-7 ~]# free -g
total used free shared buff/cache available
Mem: 1 0 0 0 0 1
Swap: 0 0 0

上面的例子中,分別以 Bytes、KB、MB、GB 為單位輸出內存信息,會自動忽略小于對應單位的數值,比如?free -g命令,只有 total 和 available 列的值大于 1GB ( 1024 * 1024 * 1024 Bytes ), 其他列的值都是小于 1GB,所以 total 和 available 列顯示 1,其他列都顯示 0

實際還有多少可用內存

[root@ecs-centos-7 ~]# free -h
total used free shared buff/cache available
Mem: 1.8G 534M 100M 8.5M 1.3G 1.5G
Swap: 0B 0B 0B

在上面的示例中,如果只是看 used 以及 free 的話,會以為系統可用內存已經不足100M,也即可使用內存不足 1%了

實際上,已經被應用程序使用的只有 27%左右(534M / 1.8G), 應用程序可用內存是 availabe 或者 free + buff/cache ,也就是說例子中實際可用于應用程序的內存有 1.5G 之多

內存什么時候告急

在平常的服務器監控內存的過程中,有以下幾個信號是需要引起注意的

  • availabe 或者 free + buff/cache 接近于0了

availabe 或者 free + buff/cache 表示實際應用程序的可用內存,如果它接近于0的話,表示應用程序可用內存不足,需要盡快處理

  • 已使用交換內存一直在增長

已使用交換內存一直增長的話,有可能是物理內存不足的先兆,當物理內存長時間不足的時候,才會頻繁的使用交換內存,導致已使用交換內存一直增長

  • 出現 Out of memory

為了防止系統物理內存不夠用的時候系統崩潰,當檢測到內存不足時,系統會 kill 掉最占用內存的進程,/var/log/message 中會記錄?Out of memory的日志

推薦閱讀
Linux 下 top 命令詳解

總結

以上是生活随笔為你收集整理的centos 没有nmtui命令_Linux free 命令的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。