From 856290c33f5e460f810f46a81ba2cdb1cb070cdf Mon Sep 17 00:00:00 2001 From: Hyperling Date: Mon, 10 Nov 2025 14:02:16 -0700 Subject: [PATCH] Add function to quickly check storage. --- files/dwm/storage.function | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 files/dwm/storage.function diff --git a/files/dwm/storage.function b/files/dwm/storage.function new file mode 100644 index 0000000..204a1d3 --- /dev/null +++ b/files/dwm/storage.function @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +function storage { + location="$1" + quiet="$2" + + if [[ -z $location ]]; then + echo "ERROR: Location must be passed. $location" + fi + + if [[ -n "$quiet" ]]; then + df -h $location | tail -n 1 | awk {print $5", "$3"/"$2""} + else + df -h $location | tail -n 1 | awk {print $5" Free, "$3"/"$2" Used"} + fi +} + +function storage-root { + storage / $1 +} +function storage-root-dwm { + storage-root q +} + +function storage-home { + storage /home $1 +} +function storage-home-dwm { + storage-root q +}