From 038f4bd165dd87c9f3e6340a612481bb3352a983 Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 22 Apr 2016 19:15:21 +0200 Subject: bin/get_mem: Adding script to output memory usage in one line in the form of: used RAM/total RAM (percentage used). --- bin/get_mem | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 bin/get_mem diff --git a/bin/get_mem b/bin/get_mem new file mode 100755 index 0000000..1709d75 --- /dev/null +++ b/bin/get_mem @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +mem_output="" +mem_output="$(free -hm| grep "Mem:"| awk '{printf $3 "/" $2 " ("} {printf ("%1.3f", $3/$2)} {printf ")"}')" + +echo "$mem_output" -- cgit v1.2.3-70-g09d2