-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bash_aliases.debian
52 lines (44 loc) · 4.1 KB
/
.bash_aliases.debian
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# vim: ft=bash noet:
! declare 2>&1 | grep -wq ^colors= && [ $BASH_VERSINFO -ge 4 ] && source $initDir/.colors
test "$debug" -gt 0 && \echo "=> Running $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal ..."
LANGUAGE_OLD=$LANGUAGE
LANGUAGE=C.UTF-8
apt="$(type -P apt) -q=0"
apt_get=$(type -P apt-get)
#alias installSecurityUpdates="sudo apt install -V $(apt-get -s dist-upgrade | awk "/^Inst.*\/$codeName-security/"'{print$2}')"
alias architecture="dpkg --print-architecture"
if [ -n "$SSH_CONNECTION" ] && type -P screen >/dev/null 2>&1;then
alias autoremove="( $apt -h 2>&1 | \grep -wq autoremove && $apt autoremove -s | \grep -wq '^Remv' && $sudo screen -L $apt autoremove -V ) || $apt_get autoremove -s | \grep -wq '^Remv' && $sudo screen -L $apt_get autoremove -V"
alias cleanupOldKernels='linux-version list;\linux-purge -l -k 2 | grep -q linux && set -x && $sudo screen -L $apt purge -V $(\linux-purge -l -k 2); set +x'
alias do-release-upgrade='$sudo screen -L do-release-upgrade'
alias dist-upgrade="sudo $apt dist-upgrade -V --no-remove --download-only && sync && $sudo screen -L $apt dist-upgrade -V --no-remove --yes;sync"
alias full-upgrade="sudo $apt full-upgrade -V --no-remove --download-only && sync && $sudo screen -L $apt full-upgrade -V --no-remove --yes;sync"
alias installSecurityUpdates="\apt list --upgradable 2>/dev/null | awk -F/ '/security/{packages=packages\" \"\$1}END{if(packages){commandLine=\"sudo screen -L apt install -V -y\"packages;print commandLine >\"/dev/stderr\";print commandLine;}}' | sh"
alias reinstallPkg="sudo screen -L $apt install --reinstall -V"
alias reinstallPkgWithConfigFiles="sudo screen -L $apt install --reinstall -V -o Dpkg::Options::=--force-confask,confnew,confmiss"
alias upgrade="LANGUAGE=$LANGUAGE $apt upgrade -s | \grep '^[1-9][0-9]* upgraded' && $sudo $apt upgrade -V --download-only && sync && $sudo screen -L $apt upgrade -V --yes;sync"
else
alias autoremove="( $apt -h 2>&1 | \grep -wq autoremove && $apt autoremove -s | \grep -wq '^Remv' && $sudo $apt autoremove -V ) || $apt_get autoremove -s | \grep -wq '^Remv' && $sudo $apt_get autoremove -V"
alias cleanupOldKernels='linux-version list;\linux-purge -l -k 2 | grep -q linux && set -x && $sudo $apt purge -V $(\linux-purge -l -k 2); set +x'
alias do-release-upgrade='$sudo do-release-upgrade'
alias dist-upgrade="sudo $apt dist-upgrade -V --no-remove --download-only && sync && $sudo $apt dist-upgrade -V --no-remove --yes;sync"
alias full-upgrade="sudo $apt full-upgrade -V --no-remove --download-only && sync && $sudo $apt full-upgrade -V --no-remove --yes;sync"
alias installSecurityUpdates="\apt list --upgradable 2>/dev/null | awk -F/ '/security/{packages=packages\" \"\$1}END{if(packages){commandLine=\"sudo apt install -V -y\"packages;print commandLine >\"/dev/stderr\";print commandLine;}}' | sh"
alias reinstallPkg="sudo $apt install --reinstall -V"
alias reinstallPkgWithConfigFiles="sudo $apt install --reinstall -V -o Dpkg::Options::=--force-confask,confnew,confmiss"
alias upgrade="LANGUAGE=$LANGUAGE $apt upgrade -s | \grep '^[1-9][0-9]* upgraded' && $sudo $apt upgrade -V --download-only && sync && $sudo $apt upgrade -V --yes;sync"
fi
alias debExport=dpkg-repack
alias debInfo="\dpkg -I"
alias debContents="\dpkg-deb -c"
alias dupdatedb="time \sudo update-dlocatedb"
alias kdeVersion="dpkg -l | awk -F'[:-]' '/plasma-desktop\s/{print \$3}'"
alias lsPPAs=$'awk -F "[ /]" \'BEGINFILE{if(ERRNO)nextfile}/^(deb|URIs:) .*launchpad.*.net/{print"https://launchpad.net/~"$5"/+archive/ubuntu/"$6"\tppa:"$5"/"$6}\' /etc/apt/sources.list.d/*-$(lsb_release -sc 2>/dev/null).list /etc/apt/sources.list.d/*-$(lsb_release -sc 2>/dev/null).sources 2>/dev/null | sort -u'
alias lsNonPPAs=$'awk \'BEGINFILE{if(ERRNO)nextfile}/launchpad.*.net|esm.ubuntu.com|^#|^\s*$/{next} {sub("^.*https?","https")} /\s#/{print$1" # "$NF} !/\s#/{print$1}\' /etc/apt/sources.list.d/*.list | sort -u'
alias update="time $sudo $apt update && $apt list --upgradable"
alias upgradable="$apt list --upgradable"
alias webpage=website
LANGUAGE=$LANGUAGE_OLD
unset apt
set +x
test "$debug" -gt 0 && \echo "=> END of $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal"