From e7835666fc0ed0c449cbcc426e6af8b5ed92ec0d Mon Sep 17 00:00:00 2001 From: hophacker Date: Thu, 16 Dec 2021 09:03:48 +0800 Subject: [PATCH] feat: add zsh cmd list-large-files --- zsh/functions.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index ec4f0a7..b3258f5 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -343,6 +343,7 @@ function gc { (git commit --verbose $*) || return (git commit --amend --author="$name <$emails[$index]>") || return } + function gcm { (gc --message $*) || return } @@ -351,7 +352,13 @@ function random_hex { openssl rand -hex $(expr $1 / 2) } -function random-string() -{ +function random-string { cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1 } + +function list-large-files { + LIST=`du $1` + echo $LIST | grep '\dK.' | sort -n + echo $LIST | grep '\dM.' | sort -n + echo $LIST | grep '\dG.' | sort -n +}