aboutsummaryrefslogtreecommitdiffstats
path: root/.functions
diff options
context:
space:
mode:
authorDominik Porada <porada@mailinator.com>2012-08-23 11:22:20 +0200
committerMathias Bynens <mathias@qiwi.be>2012-08-23 12:55:39 +0200
commit1b7314b0204c1deef419a72ceda0333039086cf0 (patch)
tree234cb0831d267fddc2c1cd1c1e045757f91395c7 /.functions
parentacfad0ca6a117341207f10a957e52deed38999c0 (diff)
downloaddotfiles-1b7314b0204c1deef419a72ceda0333039086cf0.tar.gz
dotfiles-1b7314b0204c1deef419a72ceda0333039086cf0.tar.bz2
dotfiles-1b7314b0204c1deef419a72ceda0333039086cf0.zip
.functions: Add `fs`
…and remove the `fs` alias from `.aliases`. Ref. #125.
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