New backup 2024-04-17 14:45:02

This commit is contained in:
Penelope Gwen 2024-04-17 14:45:02 -06:00
parent af2db1d036
commit ff5f5fde54

View file

@ -5,10 +5,25 @@ hyfetch
#test #test
# Quality of Life # Quality of Life
#enable using sudo with functions
function Sudo {
local firstArg=$1
if [ $(type -t $firstArg) = function ];then
shift && command sudo bash -c "$(declare -f $firstArg);$firstArg $*"
elif [ $(type -t $firstArg) = alias ];then
alias sudo='\sudo '
eval "sudo $@"
else
command sudo "$@"
fi
}
#find in history #find in history
alias h="history|grep " alias h="history|grep "
#search files in current and sub dirs #search files in current and sub dirs
alias f="find . |grep " #alias f="find . |grep "
find_file() {
find . -name *"${1}"*
}
#find running processes #find running processes
alias p="ps aux |grep " alias p="ps aux |grep "
#open file #open file
@ -16,7 +31,8 @@ alias o="open "
#find large files #find large files
#alias find_largest_files="du -h -x -s -- * | sort -r -h | head -20" #alias find_largest_files="du -h -x -s -- * | sort -r -h | head -20"
sort_filesizes() { sort_filesizes() {
sudo du -h --max-depth=1 "${1}" | sort --human-numeric-sort [ -z ${1} ] && local dir="." || local dir="${1}"
du -h --max-depth=1 "$( realpath ${dir} )" | sort --human-numeric-sort
} }
#User Env Vars #User Env Vars