]> git.rmz.io Git - dotfiles.git/blob - zsh/aliases/pacman.zsh
add pacl and paco aliases
[dotfiles.git] / zsh / aliases / pacman.zsh
1 # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
2 alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
3 alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
4 alias pacu='sudo pacman -U' # Install specific package not from the repositories but from a file
5 alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
6 alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
7 alias pacrm='sudo pacman -Rnsc' # Remove the specified package(s), its configuration(s) and unneeded dependencies
8 alias pacsi='pacman -Sii' # Display information about a given package in the repositories
9 alias pacss='pacman -Ss' # Search for package(s) in the repositories
10 alias pacqi='pacman -Qii' # Display information about a given package in the local database
11 alias pacqs='pacman -Qs' # Search for package(s) in the local database
12 alias pacl='pacman -Ql' # List all files owned by package(s)
13 alias paco='pacman -Qo' # List package owning the given file(s)
14 alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
15 alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
16
17 # https://bbs.archlinux.org/viewtopic.php?id=93683
18 paclist() {
19 pacman -Qei | awk 'BEGIN {FS=": "}/^Name/{printf("\033[1;36m%s\033[0m ",$2)}/^Description/{print $2}'
20 }
21 # [l]ist [o]orphans
22 alias paclo='sudo pacman -Qdt'
23 # [r]emove [o]orphans
24 alias pacro='sudo pacman -Rnscu $(pacman -Qtdq)'
25
26 # Display information about given packages (merges output of -Sii and -Qii)
27 paci() {
28 for p in $@; do
29 if [[ -n "$(pacman -Qq "$p" 2>/dev/null)" ]]; then
30 diff -u100 <(pacman -Qii "$p") <(pacman -Sii "$p" | sed '/^$/,$ d') | sed -e '1,3 d' -e 's/[-+ ]//'
31 else
32 pacman -Sii "$p"
33 fi
34 done
35 }
36
37 pacdisowned() {
38 tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
39 db=$tmp/db
40 fs=$tmp/fs
41
42 mkdir "$tmp"
43 trap 'rm -rf "$tmp"' EXIT
44
45 pacman -Qlq | sort -u > "$db"
46
47 find /bin /etc /lib /sbin /usr \
48 ! -name lost+found \
49 \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
50
51 comm -23 "$fs" "$db"
52 }