optimized alias names for autocomplete

This commit is contained in:
Casaper 2015-01-25 13:53:47 +01:00
parent 3216253802
commit eb42a6983a

View File

@ -23,39 +23,39 @@ if [[ -e $( which -p sudo 2>&1 ) ]]; then
fi fi
# Some self-explanatory aliases # Some self-explanatory aliases
alias apt-search="apt-cache search" alias aptsearch="apt-cache search"
alias aps='aptitude search' alias aps='aptitude search'
alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \ alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
--no-gui --disable-columns search" # search package --no-gui --disable-columns search" # search package
# apt-file # apt-file
alias apt-file-search='apt-file search --regexp' alias aptfile-search='apt-file search --regexp'
# These are apt-get only # These are apt-get only
alias apt-source='apt-get source' alias aptsource='apt-get source'
alias apt-cache-policy='apt-cache policy' alias aptcache-policy='apt-cache policy'
# superuser operations ###################################################### # superuser operations ######################################################
if [[ $use_sudo -eq 1 ]]; then if [[ $use_sudo -eq 1 ]]; then
# commands using sudo ####### # commands using sudo #######
alias apt-autoclean='sudo $apt_pref autoclean' alias aptautoclean='sudo $apt_pref autoclean'
alias apt-build-dep='sudo $apt_pref build-dep' alias aptbuild-dep='sudo $apt_pref build-dep'
alias apt-clean='sudo $apt_pref clean' alias aptclean='sudo $apt_pref clean'
alias apt-update='sudo $apt_pref update' alias aptupdate='sudo $apt_pref update'
alias apt-upgrade='sudo $apt_pref update && sudo $apt_pref upgrade' alias aptupgrade='sudo $apt_pref update && sudo $apt_pref upgrade'
alias apt-dist-upgrade='sudo $apt_pref update && sudo $apt_pref dist-upgrade' alias aptdist-upgrade='sudo $apt_pref update && sudo $apt_pref dist-upgrade'
alias apt-file-upgrade='sudo apt-file update' alias aptfile-upgrade='sudo apt-file update'
alias apt-upgrade-only='sudo $apt_pref upgrade' alias aptupgrade-only='sudo $apt_pref upgrade'
alias apt-install='sudo $apt_pref install' alias aptinstall='sudo $apt_pref install'
# Install all packages given on the command line while using only the first word of each line: # Install all packages given on the command line while using only the first word of each line:
# apt-search ... | ail # apt-search ... | ail
alias apt-install-list="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install' alias aptinstall-list="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install'
alias apt-purge='sudo $apt_pref purge' alias aptpurge='sudo $apt_pref purge'
alias apt-remove='sudo $apt_pref remove' alias aptremove='sudo $apt_pref remove'
# apt-get only # apt-get only
alias apt-deselect-upgrade='sudo apt-get dselect-upgrade' alias aptdeselect-upgrade='sudo apt-get dselect-upgrade'
# Install all .deb files in the current directory. # Install all .deb files in the current directory.
# Warning: you will need to put the glob in single quotes if you use: # Warning: you will need to put the glob in single quotes if you use:
@ -70,29 +70,29 @@ if [[ $use_sudo -eq 1 ]]; then
# commands using su ######### # commands using su #########
else else
alias apt-autoclean='su -ls \'$apt_pref autoclean\' root' alias aptautoclean='su -ls \'$apt_pref autoclean\' root'
apt-build-dep() { aptbuild-dep() {
cmd="su -lc '$apt_pref build-dep $@' root" cmd="su -lc '$apt_pref build-dep $@' root"
print "$cmd" print "$cmd"
eval "$cmd" eval "$cmd"
} }
alias apt-clean='su -ls \'$apt_pref clean\' root' alias aptclean='su -ls \'$apt_pref clean\' root'
alias apt-update='su -lc \'$apt_pref update\' root' alias aptupdate='su -lc \'$apt_pref update\' root'
alias apt-upgrade='su -lc \'$apt_pref update && aptitude safe-upgrade\' root' alias aptupgrade='su -lc \'$apt_pref update && aptitude safe-upgrade\' root'
alias apt-dist-upgrade='su -lc \'$apt_pref update && aptitude dist-upgrade\' root' alias aptdist-upgrade='su -lc \'$apt_pref update && aptitude dist-upgrade\' root'
alias apt-file-upgrade='su -lc "apt-file update"' alias aptfile-upgrade='su -lc "apt-file update"'
alias apt-upgrade-only='su -lc \'$apt_pref safe-upgrade\' root' alias aptupgrade-only='su -lc \'$apt_pref safe-upgrade\' root'
apt-install() { aptinstall() {
cmd="su -lc 'aptitude -P install $@' root" cmd="su -lc 'aptitude -P install $@' root"
print "$cmd" print "$cmd"
eval "$cmd" eval "$cmd"
} }
apt-purge() { aptpurge() {
cmd="su -lc '$apt_pref -P purge $@' root" cmd="su -lc '$apt_pref -P purge $@' root"
print "$cmd" print "$cmd"
eval "$cmd" eval "$cmd"
} }
apt-remove() { aptremove() {
cmd="su -lc '$apt_pref -P remove $@' root" cmd="su -lc '$apt_pref -P remove $@' root"
print "$cmd" print "$cmd"
eval "$cmd" eval "$cmd"
@ -129,17 +129,17 @@ apt_pref_compdef() {
compdef "$f" "$1" compdef "$f" "$1"
} }
apt_pref_compdef apt-autoclean "autoclean" apt_pref_compdef aptautoclean "autoclean"
apt_pref_compdef apt-build-dep "build-dep" apt_pref_compdef aptbuild-dep "build-dep"
apt_pref_compdef apt-clean "clean" apt_pref_compdef aptclean "clean"
apt_pref_compdef apt-update "update" apt_pref_compdef aptupdate "update"
apt_pref_compdef apt-file-upgrade "update" apt_pref_compdef aptfile-upgrade "update"
apt_pref_compdef apt-upgrade-only "upgrade" apt_pref_compdef aptupgrade-only "upgrade"
apt_pref_compdef apt-install "install" apt_pref_compdef aptinstall "install"
apt_pref_compdef apt-install-list "install" apt_pref_compdef aptinstall-list "install"
apt_pref_compdef apt-purge "purge" apt_pref_compdef aptpurge "purge"
apt_pref_compdef apt-remove "remove" apt_pref_compdef aptremove "remove"
apt_pref_compdef apt-deselect-upgrade "dselect-upgrade" apt_pref_compdef aptdeselect-upgrade "dselect-upgrade"
# Prints apt history # Prints apt history
@ -180,7 +180,7 @@ apt-history () {
# List packages by size # List packages by size
function apt-list-packages-by-size { function aptlist-packages-by-size {
dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \ dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
grep -v deinstall | \ grep -v deinstall | \
sort -n | \ sort -n | \