diff options
author | Your Name <you@example.com> | 2020-10-19 23:58:38 +0100 |
---|---|---|
committer | Your Name <you@example.com> | 2020-10-19 23:58:38 +0100 |
commit | 129126ba11abb950c7967105ad7e8f9bd74feef2 (patch) | |
tree | f14b08dba98d1ea1283e1eeea0e6002b814a5992 | |
parent | 8f1feacf875ba299fa415ab6927320409359b0fd (diff) |
Added ram percentage module
-rwxr-xr-x | modules/ram_perc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/ram_perc b/modules/ram_perc new file mode 100755 index 0000000..40c2b2f --- /dev/null +++ b/modules/ram_perc @@ -0,0 +1,13 @@ +#!/bin/bash + +# Prints the total ram and used ram in Mb + +PREFIX=' ' + +get_ram() +{ + USED_RAM=$(free | awk '/Mem/{printf("%d"), $3/$2*100}') + echo "$PREFIX$USED_RAM%" +} + +get_ram |