initial
[zsh.git] / .zsh / distri:Debian / Aliases.zsh
1 # -*- mode: sh;-*-
2
3 alias showpkg='apt-cache showpkg'
4 alias agr='LANG=C sudo aptitude remove'
5 alias agp='LANG=C sudo aptitude purge'
6 alias dclean='LANG=C LC_ALL=C fakeroot debian/rules clean'
7 alias cpan='perl -MCPAN -e shell'
8
9 #a3# Execute \kbd{apt-cache search}
10 alias acs='apt-cache search'
11 #a3# Execute \kbd{apt-cache show}
12 alias acw='apt-cache show'
13 #a3# Execute \kbd{apt-cache policy}
14 alias acp='apt-cache policy'
15 #a3# Execute \kbd{apt-get dist-upgrade}
16 salias adg="apt-get dist-upgrade"
17 #a3# Execute \kbd{apt-get install}
18 salias agi="apt-get install"
19 #a3# Execute \kbd{aptitude install}
20 salias ati="aptitude install"
21 #a3# Execute \kbd{apt-get upgrade}
22 salias ag="apt-get upgrade"
23 #a3# Execute \kbd{apt-get update}
24 salias au="apt-get update"
25 #a3# Execute \kbd{aptitude update ; aptitude safe-upgrade}
26 salias -a up="aptitude update ; aptitude safe-upgrade"
27 #a3# Execute \kbd{grep-excuses}
28 alias ge='grep-excuses'
29
30 #a3# List installed Debian-packages sorted by size
31 alias debs-by-size="dpkg-query -Wf 'x \${Installed-Size} \${Package} \${Status}\n' | sed -ne '/^x /d' -e '/^x \(.*\) install ok installed$/s//\1/p' | sort -nr"
32
33 #a3# Search using apt-file
34 alias afs='apt-file search --regexp'
35
36 # Prints apt history
37 # Usage:
38 # apt-history install
39 # apt-history upgrade
40 # apt-history remove
41 # apt-history rollback
42 # apt-history list
43 # Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
44 apt-history () {
45 case "$1" in
46 install)
47 zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
48 ;;
49 upgrade|remove)
50 zgrep --no-filename $1 $(ls -rt /var/log/dpkg*)
51 ;;
52 rollback)
53 zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \
54 grep "$2" -A10000000 | \
55 grep "$3" -B10000000 | \
56 awk '{print $4"="$5}'
57 ;;
58 list)
59 zcat $(ls -rt /var/log/dpkg*)
60 ;;
61 *)
62 echo "Parameters:"
63 echo " install - Lists all packages that have been installed."
64 echo " upgrade - Lists all packages that have been upgraded."
65 echo " remove - Lists all packages that have been removed."
66 echo " rollback - Lists rollback information."
67 echo " list - Lists all contains of dpkg logs."
68 ;;
69 esac
70 }