aboutsummaryrefslogtreecommitdiffstats
path: root/bin/get_mem
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-04-22 19:15:21 +0200
committerDavid Runge <dave@sleepmap.de>2016-04-22 19:15:21 +0200
commit038f4bd165dd87c9f3e6340a612481bb3352a983 (patch)
treeb86fa14a3b5e7abeac91218703518a4d8374493b /bin/get_mem
parent9007603576a8600d400109a14a9d34eeee0d3551 (diff)
downloaddotfiles-038f4bd165dd87c9f3e6340a612481bb3352a983.tar.gz
dotfiles-038f4bd165dd87c9f3e6340a612481bb3352a983.tar.bz2
dotfiles-038f4bd165dd87c9f3e6340a612481bb3352a983.tar.xz
dotfiles-038f4bd165dd87c9f3e6340a612481bb3352a983.zip
bin/get_mem: Adding script to output memory usage in one line in the form of: used RAM/total RAM (percentage used).
Diffstat (limited to 'bin/get_mem')
-rwxr-xr-xbin/get_mem8
1 files changed, 8 insertions, 0 deletions
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"