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.

Revisions

  1. cfstras created this gist Jul 12, 2024.
    13 changes: 13 additions & 0 deletions -often-used-package-manager-aliases.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # Often-used aliases for common package managers.

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

    Usage:

    ```bash
    sea some key words
    ```

    ```bash
    ins package-1 package-2 package-3
    ```
    38 changes: 38 additions & 0 deletions zshrc.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@


    # 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