2022-04-28 23:36:42 +02:00
|
|
|
if [ "$TERM" == 'xterm-kitty' ]; then
|
|
|
|
alias ssh='kitty +kitten ssh'
|
|
|
|
fi
|
|
|
|
|
|
|
|
DEFAULT_RSYNC='--verbose --recursive --progress --delay-updates --human-readable --links --hard-links --perms'
|
|
|
|
|
2022-05-12 13:26:00 +02:00
|
|
|
alias l='ls -l -v --all --human-readable --classify --group-directories-first' # -lvahF --group-directories-first
|
2022-04-28 23:36:42 +02:00
|
|
|
alias r='reset'
|
|
|
|
alias ..='cd ..'
|
|
|
|
alias refresh_bashrc='. ~/.bashrc' # alternatively: 'source ~/.bashrc'
|
|
|
|
alias rsync_default="rsync $DEFAULT_RSYNC --checksum"
|
2022-06-05 01:54:51 +02:00
|
|
|
# complete -F _rsync rsync_default # FIXME!!! works on oashi workstation (ubuntu) but not on manjaro ?!?
|
2022-04-28 23:36:42 +02:00
|
|
|
alias rsync_backup="rsync $DEFAULT_RSYNC --checksum --times --group --owner --delete"
|
|
|
|
alias rsync_move='rsync_default --remove-source-files'
|
|
|
|
alias rsync_update="rsync $DEFAULT_RSYNC --update --times"
|
|
|
|
alias off='systemctl poweroff'
|
|
|
|
alias nnn='nnn -dHrR'
|
|
|
|
alias nn='n -dHrR'
|
|
|
|
alias finds='find $* 2>/dev/null'
|
|
|
|
alias c='clear'
|
2022-06-05 01:54:51 +02:00
|
|
|
alias sort_dirs_by_size='du --block-size=1K --human-readable --max-depth=1 | sort --human-numeric-sort --reverse' # 'du -kh --max-depth=1 | sort -hr'
|
2022-05-12 13:26:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
# executes command and notifies upon failure
|
|
|
|
execute() {
|
|
|
|
dir="$(pwd)";
|
|
|
|
dir=${dir##*/};
|
|
|
|
if [ -n "$2" ]; then
|
|
|
|
errLog=$2
|
|
|
|
else
|
|
|
|
errLog="execution of \"$1\" failed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! $1; then
|
|
|
|
notifyError "$dir: $errLog";
|
|
|
|
return 1;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# executes command and notifies upon success or failure
|
|
|
|
executeAndNotify () {
|
|
|
|
dir="$(pwd)";
|
|
|
|
dir=${dir##*/};
|
|
|
|
if [ -n "$2" ]; then
|
|
|
|
winLog=$2
|
|
|
|
else
|
|
|
|
winLog="execution of \"$1\" succeeded"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! execute "$1" "$3"; then # arguments in quotes so they are interpreted as ONE argument each by execute()
|
|
|
|
return 1;
|
|
|
|
fi
|
|
|
|
notifyInfo "$dir: $winLog"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# find file but don't print errors (e.g. can't access directory etc.)
|
|
|
|
: 'seems to be working as alias as well:
|
|
|
|
finds () {
|
|
|
|
find $* 2>/dev/null
|
|
|
|
}'
|
|
|
|
|
|
|
|
|
|
|
|
# sends a desktop-notification with an icon signalling an error
|
|
|
|
notifyError () {
|
|
|
|
notify-send "$1" --icon=data-warning
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# sends a desktop-notification with an icon signalling a simple information
|
|
|
|
notifyInfo () {
|
|
|
|
notify-send "$1" --icon=preferences-desktop-notification
|
|
|
|
}
|