I present to you a compilation of the most useful Linux commands regarding Package Installers and repositories.
Package Installers and Repositories
Command to show required libraries
Shows the necessary libraries to run a specific program.
ldd program
Download a project from GitHub
Clones a GitHub repository to your local machine.
git clone git://github.com/directory/project.git
APT Package Updater (Ubuntu and derivatives)
Install or update a .deb package
Installs a package and its dependencies.
apt-get install package
Add a repository
Adds a repository to the system’s source list.
sudo sh -c 'echo repository' >> /etc/apt/sources.list
Add PPA repository
Adds a Personal Package Archive (PPA) to the system sources.
sudo add-apt-repository ppa:repository
Update package list
Syncs the list of available packages from the repositories.
apt-get update
Upgrade installed packages
Upgrades all installed packages to their latest version.
apt-get upgrade
Remove a package from the system
Uninstalls a package and its configuration files.
apt-get remove package
Search for a package in the repositories
Searches for a package in the APT database.
apt-cache search package
Verify dependency resolution
Checks that all dependencies are correctly installed.
apt-get check
Clean downloaded package cache
Removes .deb files from the cache to free up disk space.
apt-get clean
Upgrade distribution
Upgrades the system distribution to a new version.
apt-get dist-upgrade
Install a package without dependencies
Installs a package without installing the required dependencies.
apt-get install --no-install-recommends package
Show details of an installed package
Displays complete information about a package, including dependencies.
apt-cache show package
Remove a package along with its configurations
Uninstalls a package and also removes its configuration files.
apt-get purge package
List unnecessary packages
Shows packages that were installed automatically and are no longer needed.
apt-get autoremove
Repair broken packages
Attempts to repair packages that are in an error state.
apt-get install -f
Create a custom repository file
You can create your own repository file for APT to recognize.
echo "deb [arch=amd64] http://my-repository.com/ubuntu/ focal main" | sudo tee /etc/apt/sources.list.d/my-repository.list
View repository keys
Lists the GPG keys of the repositories you have configured.
apt-key list
Deb Packages (Debian and derivatives)
Install or update a .deb package
Installs or updates a Debian package on the system.
dpkg -i package.deb
Remove a .deb package from the system
Uninstalls an installed Debian package.
dpkg -r package
Show all installed .deb packages
Lists all currently installed Debian packages.
dpkg -l
Show .deb packages containing a specific name
Filters the list of installed packages by name.
dpkg -l | grep name
Get information about an installed package
Displays detailed information about a specific package.
dpkg -s package
Show list of files provided by an installed package
Lists all the files that belong to an installed package.
dpkg -L package
Show list of files in an uninstalled package
Displays the files included in a .deb package before installation.
dpkg --contents package.deb
Check which package a file belongs to
Determines the package that contains a specific file.
dpkg -S file
Pacman Packages (Arch Linux and derivatives)
Install a package
Installs a package on the system.
sudo pacman -S package
Update all installed packages
Updates all packages on the system to the latest available version.
sudo pacman -Syu
Remove a package
Uninstalls a package from the system.
sudo pacman -R package
Remove a package and its unused dependencies
Uninstalls a package and its dependencies that are no longer needed.
sudo pacman -Rns package
Show all installed packages
Lists all currently installed packages.
pacman -Q
Show information about an installed package
Displays detailed information about a specific package.
pacman -Qi package
Show files installed by a package
Lists all the files that belong to an installed package.
pacman -Ql package
Search for a package in the repositories
Searches for a specific package in the repositories.
pacman -Ss name
Snap Packages
Install a package
Installs a Snap package on the system.
sudo snap install package-name
Update a package
Updates a Snap package to the latest available version.
sudo snap refresh package-name
Remove a package
Uninstalls a Snap package from the system.
sudo snap remove package-name
List all installed Snap packages
Displays all currently installed Snap packages.
snap list
Get information about a Snap package
Displays detailed information about a specific Snap package.
snap info package-name
Show files of a Snap package
Lists all files from an installed Snap package.
snap run --list package-name