You are not logged in.

#1 2011-12-28 12:02:56

george55
Member
Registered: 2011-08-10
Posts: 38

Show free RAM in i3status [SOLVED]

I am trying to show the available RAM in the i3status bar. However, the manual only provides instructions on how to provide the available hard disk space, not RAM. Ideally, I show the total available RAM in MB or GB. As a newbie, I have two questions about this:

1. Is there a built-in way to display the available RAM in i3status?

2. If I need to use a script that gets the available RAM, what is the best way to do this? I have found several methods, but am wondering what is considered a good practice? For instance, I found the following:

cat /proc/meminfo | grep MemFree

From: http://blog.scoutapp.com/articles/2010/ … oc-meminfo

vmstat 1 2 | sed -n '$ p' | awk '{print $4}'

From: http://www.unix.com/solaris/25527-getti … l-ram.html

With the second script I obtain a number, which I figure is easier to divide and show as MB or GB. However, it appears to be slow. Is this the right way to do so?

Last edited by george55 (2012-12-30 19:43:03)

Offline

#2 2011-12-28 12:47:57

karol
Archivist
Registered: 2009-05-06
Posts: 25,428

Re: Show free RAM in i3status [SOLVED]

awk '/MemFree/ {print $2}' /proc/meminfo

will give you a number (representing kB).

Offline

#3 2012-12-30 19:42:22

george55
Member
Registered: 2011-08-10
Posts: 38

Re: Show free RAM in i3status [SOLVED]

Excellent, thanks!

Offline

Board footer

Powered by FluxBB