Package Manager Aliases

Monday, Jun 28, 2021
#unix #tips #void #openbsd #debian #arch

For the last 4 or 5 years I’ve been running the same short aliases to install, search, remove, and update packages on every distro I use. It started when I installed Void Linux and couldn’t deal with the stupid package manager commands and names. Seriously, sudo xbps-install -S name is just too far. I made an alias xi=sudo xbps-install -S and never looked back. Once I did that I figured I might as well make one to update and search packages.

alias xi='sudo xbps-install -S'
alias xu='sudo xbps-install -Su'
alias xs='xbps-query -Rs'

One of the neat perks is I no longer need to think about if the command needs sudo or not. You really shouldn’t be searching or listing packages with sudo, but sometimes I would out of habit. Around that time I removed some packages, fonts or something, but it turned out they were actually dependencies for some other shit I needed. It got me thinking, 99% of the time when I remove a package I don’t want it removed if it’s a dependency.

alias xr='sudo xbps-pkgdb -m auto'
alias xc='sudo xbps-remove -Oo && sudo vkpurge rm all'

xr marks a package as “automatically installed” and xc removes any packages that were not manually installed and are not being used as dependencies. Additionally it runs sudo vkpurge rm all which removes old kernel files and modules on Void. I was so happy with this setup I recreated it on all my other machines.

Void

alias xi='sudo xbps-install -S'
alias xu='sudo xbps-install -Su'
alias xs='xbps-query -Rs'
alias xr='sudo xbps-pkgdb -m auto'
alias xc='sudo xbps-remove -Oo && sudo vkpurge rm all'
alias xrm='sudo xbps-remove -R'
alias xinfo='xbps-query -R -S'
alias xlist='xpkg -m'

OpenBSD

alias xi='doas pkg_add'
alias xu='doas pkg_add -u'
alias xs='pkg_info -Q'
alias xr='doas pkg_add -aa'
alias xc='doas pkg_delete -a'
alias xrm='doas pkg_delete'
alias xinfo='pkg_info'
alias xlist='pkg_info -m'

Debian

alias xi='sudo apt install'
alias xu='sudo apt update && sudo apt upgrade'
alias xs='apt search'
alias xr='sudo apt-mark auto'
alias xc='sudo apt autoremove'
alias xrm='sudo apt remove'
alias xinfo='apt info`
alias xlist='apt-mark showmanual'

Arch

alias xi='sudo pacman -S'
alias xu='sudo pacman -Syu'
alias xs='pacman -Ss'
alias xr='sudo pacman -S --asdeps'
alias xc='pacman -Qdtq | sudo pacman -Rs -'
alias xrm='sudo pacman -Rs'
alias xinfo='pacman -Si'
alias xlist='pacman -Qe'