From 0534ec493e5bd8915c7158d8af90e9b34f17649d Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Sun, 7 Sep 2025 21:09:11 +0200 Subject: [PATCH] zsh:alias: Make `sizes` an anonymous function This way one can easily redirect stderr for both commands (not just `sort`) and specify a path. The path defaults to the current directory, but listing each entry by globbing. --- .config/zsh/zshrc.d/30-alias.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/zsh/zshrc.d/30-alias.zsh b/.config/zsh/zshrc.d/30-alias.zsh index 395055f..bdc3020 100644 --- a/.config/zsh/zshrc.d/30-alias.zsh +++ b/.config/zsh/zshrc.d/30-alias.zsh @@ -128,7 +128,7 @@ fi # Use a reasonable time format alias date='env LC_TIME=tk_TM date' # List human readable sizes in order - alias sizes='du -sch * | sort -h' + alias sizes='() { du -sch ${1:-*} "${@[2,-1]}" | sort -h }' # Count number of occurrences for every line in stdin alias count='sort | uniq -c | sort -n' # Inspired by https://stackoverflow.com/a/54541337