diff options
Diffstat (limited to 'plugins/ubuntu')
-rw-r--r-- | plugins/ubuntu/readme.md | 4 | ||||
-rw-r--r-- | plugins/ubuntu/ubuntu.plugin.zsh | 85 |
2 files changed, 50 insertions, 39 deletions
diff --git a/plugins/ubuntu/readme.md b/plugins/ubuntu/readme.md index c9ef61f4e..99d62a6f7 100644 --- a/plugins/ubuntu/readme.md +++ b/plugins/ubuntu/readme.md @@ -10,12 +10,12 @@ By now you already can guess almost all aliases There are two exeptions since ... agu = sudo Apt-Get Update - we have ... -agug = sudo Apt-Get UpGrade - as the exeptional 4 letter alias for a single command. +agug = sudo Apt-Get UpGrade - as the exceptional 4 letter alias for a single command. afs = Apt-File Search --regexp - this has the regexp switch on without being represented in the alias, I guess this makes sense since the debian plugin has it, I never used that command. Then there are the 2 other 4 letter aliases for combined commands, that are straight forward and easy to remember. aguu = sudo Apt-Get Update && sudo apt-get Upgrade - better then adg or not? -agud = sudo Apt-Get Update && sudo apt-get Dist-upgrade +agud = sudo Apt-Get Update && sudo apt-get full-upgrade For a full list aliases and the functions just watch the plugins code https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/ubuntu/ubuntu.plugin.zsh, look at the comments if you want to switch from the debian plugin. Ubuntu, Mint and & co users will like the new aar function to install packages from ppas with a single command. diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index d924f8861..198f06743 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -2,60 +2,71 @@ # https://github.com/AlexBio # https://github.com/dbb # https://github.com/Mappleconfusers +# https://github.com/trinaldi # Nicolas Jonas nextgenthemes.com # https://github.com/loctauxphilippe +# https://github.com/HaraldNordgren # # Debian, Ubuntu and friends related zsh aliases and functions for zsh +(( $+commands[apt] )) && APT=apt || APT=apt-get + alias acs='apt-cache search' compdef _acs acs='apt-cache search' alias afs='apt-file search --regexp' compdef _afs afs='apt-file search --regexp' -# These are apt-get only -alias ags='apt-get source' # asrc -compdef _ags ags='apt-get source' +# These are apt/apt-get only +alias ags="$APT source" # asrc +compdef _ags ags="$APT source" alias acp='apt-cache policy' # app compdef _acp acp='apt-cache policy' +#List all installed packages +alias agli='apt list --installed' +compdef _agli agli='apt list --installed' + # superuser operations ###################################################### + +# List available updates only +alias aglu='sudo apt-get -u upgrade --assume-no' +compdef _aglu aglu='sudo apt-get -u upgrade --assume-no' + alias afu='sudo apt-file update' compdef _afu afu='sudo apt-file update' alias ppap='sudo ppa-purge' compdef _ppap ppap='sudo ppa-purge' -alias ag='sudo apt-get' # age - but without sudo -alias aga='sudo apt-get autoclean' # aac -alias agar='sudo apt-get autoremove' -alias agb='sudo apt-get build-dep' # abd -alias agc='sudo apt-get clean' # adc -alias agd='sudo apt-get dselect-upgrade' # ads -alias agi='sudo apt-get install' # ai -alias agp='sudo apt-get purge' # ap -alias agr='sudo apt-get remove' # ar -alias agu='sudo apt-get update' # ad -alias agud='sudo apt-get update && sudo apt-get dist-upgrade' #adu -alias agug='sudo apt-get upgrade' # ag -alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg -alias agar='sudo apt-get autoremove' - -compdef _ag ag='sudo apt-get' -compdef _aga aga='sudo apt-get autoclean' -compdef _agar agar='sudo apt-get autoremove' -compdef _agb agb='sudo apt-get build-dep' -compdef _agc agc='sudo apt-get clean' -compdef _agd agd='sudo apt-get dselect-upgrade' -compdef _agi agi='sudo apt-get install' -compdef _agp agp='sudo apt-get purge' -compdef _agr agr='sudo apt-get remove' -compdef _agu agu='sudo apt-get update' -compdef _agud agud='sudo apt-get update && sudo apt-get dist-upgrade' -compdef _agug agug='sudo apt-get upgrade' -compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' -compdef _agar agar='sudo apt-get autoremove' +alias ag="sudo $APT" # age - but without sudo +alias aga="sudo $APT autoclean" # aac +alias agb="sudo $APT build-dep" # abd +alias agc="sudo $APT clean" # adc +alias agd="sudo $APT dselect-upgrade" # ads +alias agi="sudo $APT install" # ai +alias agp="sudo $APT purge" # ap +alias agr="sudo $APT remove" # ar +alias agu="sudo $APT update" # ad +alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu +alias agug="sudo $APT upgrade" # ag +alias aguu="sudo $APT update && sudo $APT upgrade" #adg +alias agar="sudo $APT autoremove" + +compdef _ag ag="sudo $APT" +compdef _aga aga="sudo $APT autoclean" +compdef _agb agb="sudo $APT build-dep" +compdef _agc agc="sudo $APT clean" +compdef _agd agd="sudo $APT dselect-upgrade" +compdef _agi agi="sudo $APT install" +compdef _agp agp="sudo $APT purge" +compdef _agr agr="sudo $APT remove" +compdef _agu agu="sudo $APT update" +compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade" +compdef _agug agug="sudo $APT upgrade" +compdef _aguu aguu="sudo $APT update && sudo $APT upgrade" +compdef _agar agar="sudo $APT autoremove" # Remove ALL kernel images and headers EXCEPT the one in use alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ @@ -71,7 +82,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' # apt-add-repository with automatic install/upgrade of the desired package # Usage: aar ppa:xxxxxx/xxxxxx [packagename] # If packagename is not given as 2nd argument the function will ask for it and guess the default by taking -# the part after the / from the ppa name wich is sometimes the right name for the package you want to install +# the part after the / from the ppa name which is sometimes the right name for the package you want to install aar() { if [ -n "$2" ]; then PACKAGE=$2 @@ -83,8 +94,8 @@ aar() { PACKAGE=${1##*/} fi - sudo apt-add-repository $1 && sudo apt-get update - sudo apt-get install $PACKAGE + sudo apt-add-repository $1 && sudo $APT update + sudo $APT install $PACKAGE } # Prints apt history @@ -94,7 +105,7 @@ aar() { # apt-history remove # apt-history rollback # apt-history list -# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html +# Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html apt-history () { case "$1" in install) @@ -110,7 +121,7 @@ apt-history () { awk '{print $4"="$5}' ;; list) - zcat $(ls -rt /var/log/dpkg*) + zgrep --no-filename '' $(ls -rt /var/log/dpkg*) ;; *) echo "Parameters:" |