• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Archives for March 2023

Memory Info on Linux

March 15, 2023

Here’s how to view system memory on Linux.

Default display is in kB

cat /proc/meminfo
MemTotal:        7492768 kB
MemFree:          427368 kB
MemAvailable:    5424768 kB

cat /proc/meminfo MemTotal: 7492768 kB MemFree: 427368 kB MemAvailable: 5424768 kB

Display in MB

awk '$3=="kB"{$2=$2/1024;$3="MB"} 1' /proc/meminfo | column -t
MemTotal:           7317.16      MB
MemFree:            404.527      MB
MemAvailable:       5285.4       MB

awk '$3=="kB"{$2=$2/1024;$3="MB"} 1' /proc/meminfo | column -t MemTotal: 7317.16 MB MemFree: 404.527 MB MemAvailable: 5285.4 MB

Output in GB

awk '$3=="kB"{$2=$2/1024^2;$3="GB";} 1' /proc/meminfo | column -t
MemTotal:           7.14566      GB
MemFree:            0.370392     GB
MemAvailable:       5.13733      GB

awk '$3=="kB"{$2=$2/1024^2;$3="GB";} 1' /proc/meminfo | column -t MemTotal: 7.14566 GB MemFree: 0.370392 GB MemAvailable: 5.13733 GB

Filed Under: Linux Tagged With: display, linux, meminfo, memory, proc

  • Home
  • About
  • Archives

Copyright © 2023