config/shell: move disk usage infos to bin scripts
This commit is contained in:
parent
abd18a232d
commit
311ef51c27
|
@ -195,7 +195,7 @@ clearNpmCache() {
|
||||||
npm install
|
npm install
|
||||||
}
|
}
|
||||||
|
|
||||||
# NAVIGATION & DISK
|
# NAVIGATION
|
||||||
|
|
||||||
alias rcd="cd $PWD"
|
alias rcd="cd $PWD"
|
||||||
cdd() { cd "$@" 2>/dev/null || cd "$(dirname "$1")" "${@:2}" }
|
cdd() { cd "$@" 2>/dev/null || cd "$(dirname "$1")" "${@:2}" }
|
||||||
|
@ -219,26 +219,12 @@ cl() {
|
||||||
ls --almost-all --group-directories-first --file-type
|
ls --almost-all --group-directories-first --file-type
|
||||||
}
|
}
|
||||||
|
|
||||||
# like "which", but shows contents if it resolves to a file
|
# FILES
|
||||||
wh() {
|
|
||||||
res=$(which "$@")
|
|
||||||
test -f "$res" && b "$res" || echo "$res"
|
|
||||||
}
|
|
||||||
|
|
||||||
# shows size statistics for subfolders
|
|
||||||
s() {
|
|
||||||
case "$1" in [0-9]) local depth=$1; shift;; esac
|
|
||||||
sudo du --max-depth "${depth:-1}" -xhat 50M "$@" | sort -h | grep -v "^0"
|
|
||||||
}
|
|
||||||
# disk size usage information
|
|
||||||
alias sd='df -B1M -x tmpfs -x devtmpfs -x squashfs | awk -v a="\033[31m" -v b="\033[33m" -v c="\033[35m" -v n="\033[0m" '"'"'NR==1 {printf "%-20s %6s %7s %9s %s\n",$1,$5,$3,$4,$6} NR>1 {u=strtonum($5); printf (u > 99) ? a : (u > 97) ? b : (u > 94) ? c : ""; printf "%-20s %6s %6.1fG %8.1fG %s\n",$1,$5,$3/1000,$4/1000,$6; printf n}'"'"
|
|
||||||
|
|
||||||
alias f='noglob fd --no-ignore-vcs'
|
alias f='noglob fd --no-ignore-vcs'
|
||||||
#alias f='find -not -path "*.sync*" -and -not \( -name daten -prune \)'
|
#alias f='find -not -path "*.sync*" -and -not \( -name daten -prune \)'
|
||||||
#alias f1='find -mindepth 1 -maxdepth 1'
|
#alias f1='find -mindepth 1 -maxdepth 1'
|
||||||
|
|
||||||
# FILES
|
|
||||||
|
|
||||||
which perl-rename >/dev/null && alias lowercase='perl-rename "y/A-Z/a-z/"' || alias lowercase='rename "y/A-Z/a-z/"'
|
which perl-rename >/dev/null && alias lowercase='perl-rename "y/A-Z/a-z/"' || alias lowercase='rename "y/A-Z/a-z/"'
|
||||||
|
|
||||||
mkcd() {
|
mkcd() {
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# shows size statistics for subfolders
|
||||||
|
# max depth is equal to the first argument if it is a number or 1
|
||||||
|
case "$1" in [0-9]) local depth=$1; shift;; esac
|
||||||
|
sudo du --max-depth "${depth:-1}" -xhat 50M "$@" | sort -h | grep -v "^0"
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# disk size usage information
|
||||||
|
df -B1M -x tmpfs -x devtmpfs -x squashfs | awk -v a="\033[31m" -v b="\033[33m" -v c="\033[35m" -v n="\033[0m" 'NR==1 {printf "%-20s %6s %7s %9s %s\n",$1,$5,$3,$4,$6} NR>1 {u=strtonum($5); printf (u > 99) ? a : (u > 97) ? b : (u > 94) ? c : ""; printf "%-20s %6s %6.1fG %8.1fG %s\n",$1,$5,$3/1000,$4/1000,$6; printf n}'
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# like "which", but shows contents if it resolves to a file
|
||||||
|
res=$(which "$@")
|
||||||
|
test -r "$res" && b --plain "$res" || echo "$res"
|
Loading…
Reference in New Issue