- Command Line
- Bash Scripting
- Curl
- Package Management
- Version Management
- Git
- Toolbox
- Virtualization
- Visual Studio Code
- Vim
- Boilerplates
- Hosting
- Basics
- Cheat Sheet
- Compose
- APIs
- CSS
- Concepts
- Date & Time
- Formatting
- Sass
- Bootstrap
- MySQL
Cheat Sheets
Tools
Docker
Guidelines
JavaScript
CSS
Databases
Cheat Sheets - Package Management
Table of Contents
apt
Check Whether or Not a Package is Installed
$ dpkg --list qemu*
...
un qemu-system-x86-64 <none> <none> (no description available)
ii qemu-utils 1:4.2-3ubuntu6.6 amd64 QEMU utilities
un: not installed
ii: installed
pacman
Update the Database
$ sudo pacman -Sy
# S: sync to the master package database
# y: refresh the local copy of the master package database
Or
$ sudo pacman -Syy
to force pacman to update the package database by recreating it.
Search for Packages
$ pacman -Ss <search_term>
Install Packages
$ sudo pacman -S <package_name_1> <package_name_2>
Upgrade Packages
$ sudo pacman -Syu
Remove Packages
Only the package preserving its dependencies:
$ sudo pacman -R <package_name>
Remove package with dependencies not required by any other package:
$ sudo pacman -Rs <package_name>
Source:
- https://itsfoss.com/pacman-command/
- https://linuxhint.com/pacman_arch_linux/
- https://www.digitalocean.com/community/tutorials/how-to-use-arch-linux-package-management
Homebrew
List Installed Packages
brew list
Install Specific Version of a Package
Search the package:
$ brew search package
Install a specific version:
$ brew install package@5
We may have multiple versions of a package installed, but only one active at a time. We need to unlink an exisitng package before making the installed one active:
$ brew unlink package
$ brew link package@5
We may need to use the options below depending on the package:
$ brew link --force --overwrite package@5
Gems (Ruby)
List Installed Gems
$ gem list
pip (Python)
List Installed Packages
$ pip list
npm (Node - packages.json)
List Installed Packages (Global)
$ npm list -g
Dependencies
Options for dependency declaration, especially version definition.
version
Must matchversion
exactly>version
Must be greater thanversion
>=version
etc<version
<=version
~version
Approximately equivalent toversion
^version
Compatible withversion
1.2.x
1.2.0, 1.2.1, etc., but not 1.3.0http://...
*
Matches any version""
(just an empty string) Same as*
version1 - version2
Same as>=version1
<=version2
range1 || range2
Passes if eitherrange1
orrange2
are satisfiedgit...
user/repo
tag
A specific version tagged and published astag
path/path/path
For example, these are all valid:
Source: https://docs.npmjs.com/files/package.json#dependencies