Skip to content

Instantly share code, notes, and snippets.

@cfstras
Created July 12, 2024 13:55
Show Gist options
  • Save cfstras/2625dba8700b921ed362a992829feb0c to your computer and use it in GitHub Desktop.
Save cfstras/2625dba8700b921ed362a992829feb0c to your computer and use it in GitHub Desktop.
Often-used aliases for common package managers. Add them to your bashrc/zshrc! Never think about which OS you're currently using!

Often-used aliases for common package managers.

Add them to your bashrc/zshrc! Never think about which OS you're currently using!

Usage:

sea some key words
ins package-1 package-2 package-3
# often used apt-get aliases
if [ -x /usr/bin/apt-get ]; then
alias ins='sudo apt install'
alias sea='sudo apt search'
alias update='sudo apt-get -y update && sudo apt-get upgrade'
alias apt-history='(zcat /var/log/apt/history.log.*.gz; cat /var/log/apt/history.log) | grep -B1 Commandline'
alias apt-hist='(zcat /var/log/apt/history.log.*.gz; cat /var/log/apt/history.log) | egrep "Commandline.* (install|remove)" | cut -c22-'
elif [ -x /usr/bin/yum ]; then
GRML_NO_APT_ALIASES=1
alias ins='sudo yum install'
alias update='sudo yum update'
alias yum='sudo yum'
elif [ -x /usr/bin/yay ]; then
GRML_NO_APT_ALIASES=1
alias ins='yay -S --needed'
alias sea='yay -Ss'
alias update="yay -Syu"
elif [ -x /usr/bin/pacman ]; then
alias ins='sudo pacman -S --needed'
alias sea='pacman -Ss'
alias update="sudo pacman -Syu"
elif [ -x /usr/local/bin/brew ] || [ -x /opt/homebrew/bin/brew ]; then
function ins() {
for prog in "$@"; do
if info=$(brew info "$prog" 2>&1); then
brew install "$prog"
else
echo "$info"
fi
done
}
alias sea='brew search'
alias update='brew update && brew upgrade'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment