New backup 2024-04-17 14:45:02
This commit is contained in:
parent
af2db1d036
commit
ff5f5fde54
1 changed files with 18 additions and 2 deletions
|
@ -5,10 +5,25 @@ hyfetch
|
|||
#test
|
||||
|
||||
# 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
|
||||
alias h="history|grep "
|
||||
#search files in current and sub dirs
|
||||
alias f="find . |grep "
|
||||
#alias f="find . |grep "
|
||||
find_file() {
|
||||
find . -name *"${1}"*
|
||||
}
|
||||
#find running processes
|
||||
alias p="ps aux |grep "
|
||||
#open file
|
||||
|
@ -16,7 +31,8 @@ alias o="open "
|
|||
#find large files
|
||||
#alias find_largest_files="du -h -x -s -- * | sort -r -h | head -20"
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue