パッケージマネージャーのチートシート

Kazuki Koide

November 30, 2018

前回の設定ファイルの書式と同様、パッケージマネージャーのコマンドもチートシートを作ってみた。コマンドのhelpで確認はできるが、パッケージマネージャーによってコマンドの意味が微妙に違っていたりするのでチートシートで目的からコマンドの逆引きしたほうが安心できる。自分用なので自分が使うものだけとはいえapt(Debian)、yum(Red Hat)、Homebrew(Mac OS)、npm(JavaScript)、yarn(JavaScript)、pip(Python)、dep(Golang)と結構種類が多い。パッケージマネージャーとはやや異なるがfisherman(fish)、Helm(Kubernetes)もついでなので一緒に記載しておいた。

Use Case apt(旧) apt(新) yum Homebrew npm yarn pip dep fisherman Helm
パッケージ追加 apt-get install apt-install yum install brew install npm install yarn add pip install dep ensure fisher install helm install
パッケージ削除 apt-get remove apt remove yum remove brew uninstall npm uninstall yarn remove pip uninstall dep remove fisher rm helm delete
リポジトリ更新 apt-get update apt update - brew update - - - - - helm update
パッケージ更新 apt-get upgrade apt upgrade yum update brew upgrade npm update yarn upgrade pip install -U - fisher update helm upgrade
パッケージ検索 apt-cache search apt search yum search brew search npm search - pip search - - helm search
パッケージ詳細 apt-cache show apt show yum info brew info npm view yarn info pip show - - helm inspect
追加したパッケージの確認 dpkg -l dpkg -l yum list installed brew list npm ls yarn list pip list dep status fisher ls helm list
ゴミパッケージの掃除 apt-get autoremove apt autoremove yum autoremove - npm prune yarn install - dep prune - -

Homebrewにautoremoveが無くて辛いことが良くあって、何か方法はないかと調べたらスクリプトをつくっている人がいた(しかもfish)。ありがたく拝借した。