ArchLinux users, manage packages with a fuzzy finder

packages

ArchLinux has several graphical package managers like Pamac. When you’re already in the shell, it’s faster to stay there. One of the annoyance I often have is that when I search for a package, I do a search, then filter the results with GREP, then sort the results to a pager and then try to find the package I want. It’s not fun nor modern.

Let’s bring FSF to the rescue. FZF is a fuzzy finder that can filter any strings to your liking. The first step will be to install FZF on your machine

sudo pacman -S fzf 

I had the idea of mixing package management tools to FZF to help install or remove packages. If you want to use my configuration, copy the following sections to your .bashrc (for Bash) or .zshrc (for ZSH)

If you use PACMAN:

export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border --exact +s'
alias pacman_install="sudo pacman -S \$(pacman -Sl|awk '{print \$2}'|fzf -m)"
alias pacman_uninstall="sudo pacman -Rcs \$(pacman -Q|awk '{print \$1}'|fzf -m)"
alias pacman_update='sudo pacman -Syyu'

If you use PARU:

export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border --exact +s'
alias paru_install="paru -S \$(paru -Sl|awk '{print \$2}'|fzf -m)"
alias paru_uninstall="paru -Rcs \$(paru -Q|awk '{print \$1}'|fzf -m)"
alias paru_update='paru -Syyu'

If you use YAY:

export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border --exact +s'
alias yay_install="yay -S \$(yay -Sl|awk '{print \$2}'|fzf -m)"
alias yay_uninstall="yay -Rcs \$(yay -Q|awk '{print \$1}'|fzf -m)"
alias yay_update='yay -Syyu'

Once this is done, type any of the following : pacman_install, pacman_uninstall or pacman_update + ENTER KEY, to do the desired operations.

This is an example for pacman_install, you can filter by typing text, and press the ENTER key on the package you want to install. To select several packages, use the TAB key to select/unselect them.

This is an example for pacman_uninstall, you can filter by typing text, and press the ENTER key on the package you want to install. To select several packages, use the TAB key to select/unselect them. In this example I have selected 2 packages (with the TAB key). Pressing the ENTER key will proceed with the uninstall sequence and confirmation.