config/shell: update functions & add directory shortcuts
This commit is contained in:
parent
35e9a03822
commit
bffe2ce0a1
|
@ -5,15 +5,21 @@ alias -g ___='"$(eval "$(fc -ln -1)" | tail -n 1)"'
|
||||||
alias -g G="| grp"
|
alias -g G="| grp"
|
||||||
alias -g X="| xargs"
|
alias -g X="| xargs"
|
||||||
alias -g X1="| xargs -n 1"
|
alias -g X1="| xargs -n 1"
|
||||||
alias -g xdh="$XDG_DATA_HOME"
|
|
||||||
alias -g xch="$XDG_CONFIG_HOME"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
alias info='info --vi-keys'
|
||||||
|
|
||||||
|
xdh="$XDG_DATA_HOME"
|
||||||
|
xch="$XDG_CONFIG_HOME"
|
||||||
|
d1=$(cd $DATA/1* && pwd)
|
||||||
|
d2=$(cd $DATA/2* && pwd)
|
||||||
|
d3=$(cd $DATA/3* && pwd)
|
||||||
|
d4=$DATA/4*
|
||||||
|
|
||||||
ulimit -c unlimited # Enable core dumps
|
ulimit -c unlimited # Enable core dumps
|
||||||
|
|
||||||
which lsb_release >/dev/null && export DIST=$(lsb_release --id | cut -d' ' -f2) || true
|
which lsb_release >/dev/null && export DIST=$(lsb_release --id | cut -d' ' -f2) || true
|
||||||
|
|
||||||
alias info='info --vi-keys'
|
|
||||||
unalias rd
|
unalias rd
|
||||||
rd() {
|
rd() {
|
||||||
test -d "$1" && find "$1" -type d -empty -printf "Removing %p\n" -delete || rm "$@"
|
test -d "$1" && find "$1" -type d -empty -printf "Removing %p\n" -delete || rm "$@"
|
||||||
|
@ -65,7 +71,7 @@ edshell() {
|
||||||
esac
|
esac
|
||||||
checksum="$(md5sum $file)"
|
checksum="$(md5sum $file)"
|
||||||
$EDITOR $file
|
$EDITOR $file
|
||||||
test "$checksum" != "$(md5sum $file)" && source $HOME/.zprofile && exec $SHELL
|
test "$checksum" != "$(md5sum $file)" && source "$HOME/.zprofile" && exec $SHELL
|
||||||
}
|
}
|
||||||
|
|
||||||
edbin() {
|
edbin() {
|
||||||
|
@ -110,7 +116,7 @@ alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
||||||
alias lar='last | tac'
|
alias lar='last | tac'
|
||||||
tr() { tree -a -L 2 --du -h -C "$@" | ${PAGER:-less} }
|
tr() { tree -a -L 2 --du -h -C "$@" | ${PAGER:-less} }
|
||||||
|
|
||||||
alias browse-safe='sudo systemctl disable --now systemd-resolved && sudo rm /etc/resolv.conf && sudo cp /etc/resolv.conf.bak /etc/resolv.conf && sudo chattr +i /etc/resolv.conf'
|
alias browse-safe='sudo systemctl disable --now systemd-resolved && sudo rm -f /etc/resolv.conf && echo "nameserver 185.228.168.10" | sudo tee /etc/resolv.conf && sudo chattr +i /etc/resolv.conf'
|
||||||
alias browse-unsafe='sudo chattr -i /etc/resolv.conf && sudo mv /etc/resolv.conf /etc/resolv.conf.bak && sudo systemctl enable --now systemd-resolved'
|
alias browse-unsafe='sudo chattr -i /etc/resolv.conf && sudo mv /etc/resolv.conf /etc/resolv.conf.bak && sudo systemctl enable --now systemd-resolved'
|
||||||
|
|
||||||
xo() {
|
xo() {
|
||||||
|
@ -248,7 +254,7 @@ cl() {
|
||||||
|
|
||||||
# FILES
|
# FILES
|
||||||
|
|
||||||
alias f='noglob fd --no-ignore-vcs'
|
alias f='noglob fd --hidden --color=always --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'
|
||||||
|
|
||||||
|
@ -268,12 +274,6 @@ mvf() {
|
||||||
smv "$1" "$(dirname $1)/$2"
|
smv "$1" "$(dirname $1)/$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Creates directory $2 and moves $1 into it
|
|
||||||
mvk() {
|
|
||||||
mkdir -p $(case "$2" in (*/) echo "$2";; (*) dirname "$2";; esac)
|
|
||||||
mv "$1" "$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Moves from $1 to $2 and replaces the original with a relative symlink
|
# Moves from $1 to $2 and replaces the original with a relative symlink
|
||||||
mvln() {
|
mvln() {
|
||||||
file=$(test -f "$1" && echo 1 || echo 0)
|
file=$(test -f "$1" && echo 1 || echo 0)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Mount a partition by label automatically
|
||||||
|
sudo mkdir -p "${2:-/mnt/$1}"
|
||||||
|
sudo mount -L "$1" "${2:-/mnt/$1}"
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Creates the last arg as directory and moves everything else into it
|
||||||
|
|
||||||
|
for last; do true; done
|
||||||
|
|
||||||
|
mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)
|
||||||
|
mv "$@"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# shows size statistics for subfolders
|
# shows size statistics for subfolders
|
||||||
# max depth is equal to the first argument if it is a number or 1
|
# 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
|
case "$1" in [0-9]) depth=$1; shift;; esac
|
||||||
sudo du --max-depth "${depth:-1}" -xhat 50M "$@" | sort -h | grep -v "^0"
|
sudo du --max-depth "${depth:-1}" -xhat 50M "$@" | sort -h | grep -v "^0"
|
||||||
|
|
Loading…
Reference in New Issue