aboutsummaryrefslogtreecommitdiffstats
path: root/.functions
diff options
context:
space:
mode:
Diffstat (limited to '.functions')
-rw-r--r--.functions14
1 files changed, 14 insertions, 0 deletions
diff --git a/.functions b/.functions
index ddb0f82..f1c94e6 100644
--- a/.functions
+++ b/.functions
@@ -3,6 +3,20 @@ function mkd() {
mkdir -p "$@" && cd "$@"
}
+# Determine size of a file or total size of a directory
+function fs() {
+ if du -shb /dev/null > /dev/null 2>&1; then
+ local arg=-sbh
+ else
+ local arg=-skh
+ fi
+ if [[ -n "$@" ]]; then
+ du $arg -- "$@"
+ else
+ du $arg .[^.]* *
+ fi
+}
+
# Use Git’s colored diff when available
hash git &>/dev/null
if [ $? -eq 0 ]; then