The package management commands in Linux are used to manage software packages. Using these commands, users can install, update, remove, and search for software packages.
| Command | Description |
|---|---|
| Debian and Ubuntu: | |
| apt-get update | This command is used to update the local package index from the repositories specified in the sources.list file. |
| apt-get upgrade | This command is used to upgrade all the currently installed packages to their latest versions. |
| apt-get install [package-name] | This command is used to install a package or multiple packages. |
| apt-get remove [package-name] | This command is used to remove a package from the system. |
| apt-get autoremove | This command is used to remove any packages that were installed as dependencies but are no longer needed. |
| apt-get purge [package-name] | This command is used to remove a package along with its configuration files. |
| apt-get clean | This command is used to clean up the local repository of retrieved package files that are no longer needed. |
| apt-cache search [search-term] | This command is used to search for a package based on a search term. |
| apt-cache show [package-name] | This command is used to display detailed information about a package, including its dependencies. |
| dpkg -i [package-name.deb] | This command is used to install a package from a .deb file. |
| dpkg -r [package-name] | This command is used to remove a package from the system. |
| dpkg -L [package-name] | This command is used to list all the files that were installed by a package. |
| Fedora, CentOS, Rocky Linux & Red Hat: | |
| dnf update | This command is used to update all installed packages on the system. |
| dnf install [package-name] | This command is used to install a specific package or multiple packages. |
| dnf remove [package-name] | This command is used to remove a specific package from the system. |
| dnf search [search-term] | This command is used to search for packages based on a search term. |
| dnf info [package-name] | This command is used to display detailed information about a package, including its dependencies. |
| rpm -qa | This command is used to list all installed packages on the system. |
| rpm -qi [package-name] | This command is used to display information about a specific package, including its version and installation date. |
| rpm -ql [package-name] | This command is used to list all files installed by a package. |
| yum update | This command is used to update all installed packages on the system (older versions of Fedora, CentOS, and Red Hat). |
| yum install [package-name] | This command is used to install a specific package or multiple packages (older versions of Fedora, CentOS, and Red Hat). |
| yum remove [package-name] | This command is used to remove a specific package from the system (older versions of Fedora, CentOS, and Red Hat). |
| yum search [search-term] | This command is used to search for packages based on a search term (older versions of Fedora, CentOS, and Red Hat). |
| yum info [package-name] | This command is used to display detailed information about a package, including its dependencies (older versions of Fedora, CentOS, and Red Hat). |
| Arch Linux: | |
| pacman | |
| pacman -Syu: | This command is used to update all installed packages on the system. |
| pacman -S [package-name]: | This command is used to install a specific package or multiple packages. |
| pacman -Rs [package-name]: | This command is used to remove a specific package from the system. |
| pacman -Ss [search-term]: | This command is used to search for packages based on a search term. |
| pacman -Qi [package-name]: | This command is used to display detailed information about a package, including its dependencies. |
| pacman -Q: | This command is used to list all installed packages on the system. |
| pacman -Ql [package-name]: | This command is used to list all files installed by a package. |
| pacman -U [package-file]: | This command is used to install a package from a local file. |
| pacman -Sc: | This command is used to clean up the package cache, removing old and unused package versions. |
| yaourt | Yet Another User Repository Tool |
| yaourt -Syua: | This command is used to update all installed packages on the system, including AUR packages. |
| yaourt -S [package-name]: | This command is used to install a specific package or multiple packages from the AUR. |
| yaourt -Rs [package-name]: | This command is used to remove a specific package from the system, including its dependencies. |
| yaourt -Ss [search-term]: | This command is used to search for packages in the AUR based on a search term. |
| yaourt -Qi [package-name]: | This command is used to display detailed information about an AUR package, including its dependencies. |
| yaourt -Qm: | This command is used to list all installed packages from the AUR. |
| yaourt -Ql [package-name]: | This command is used to list all files installed by an AUR package. |
| yaourt -U [package-name]: | This command is used to update an AUR package if a new version is available. |
| packer | |
| packer -Syu: | This command is used to update all installed packages on the system, including AUR packages. |
| packer -Syu: | This command is used to update all installed packages on the system, including AUR packages. |
| packer -S [package-name]: | This command is used to install a specific package or multiple packages from the AUR. |
| packer -Rs [package-name]: | This command is used to remove a specific package from the system, including its dependencies. |
| packer -Ss [search-term]: | This command is used to search for packages in the AUR based on a search term. |
| packer -Qi [package-name]: | This command is used to display detailed information about an AUR package, including its dependencies. |
| packer -Qm: | This command is used to list all installed packages from the AUR. |
| packer -Ql [package-name]: | This command is used to list all files installed by an AUR package. |
| packer -U [package-name]: | This command is used to update an AUR package if a new version is available. |
| Gentoo: | |
| emerge | |
| emerge --sync | This command syncs the local portage tree with the Gentoo repository. |
| emerge --update --deep --newuse @world | This command updates all installed packages on the system, including dependencies. |
| emerge [package-name] | This command is used to install a specific package or multiple packages. |
| emerge -C [package-name] | This command is used to remove a specific package from the system. |
| emerge -s [search-term] | This command is used to search for packages based on a search term. |
| emerge -pv [package-name] | This command is used to display detailed information about a package, including its dependencies. |
| emerge --info [package-name] | This command is used to display detailed information about a package, including its dependencies, USE flags, and installed files. |
| emerge -puvDN world | This command lists all available updates to packages on the system. |
| emerge --depclean | This command is used to remove unused dependencies from the system. |
| emerge --ask --verbose [package-name] | This command is used to install a package, prompting the user for confirmation and displaying detailed information during the installation process. |
| eix | |
| eix-sync | This command syncs the local eix database with the Gentoo repository. |
| eix [search-term] | This command is used to search for packages based on a search term. |
| eix-test-obsolete | This command is used to check for obsolete packages on the system. |
| eix-update | This command updates the local eix database with information about new and updated packages. |
| eix-remote update | This command updates the remote eix database with information about new and updated packages. |
| eix-diff | This command shows the differences between the local and remote eix databases. |
| layman | |
| layman -S | This command syncs the local overlays with the Gentoo repository. |
| layman -a [overlay-name] | This command adds a new overlay to the local overlays list. |
| layman -d [overlay-name]: | This command removes an overlay from the local overlays list. |
| layman -L: | This command lists all available overlays. |
| layman -f: | This command forces a sync of the local overlays with the Gentoo repository. |
| layman -u [overlay-name]: | This command updates an overlay to the latest version. |
| layman -s [overlay-name]: | This command shows information about a specific overlay. |
2 replies on “Linux Package Management Command Cheat Sheet”
Nice work, but OpenSuse is missing… 🙁
Thank you for bringing that to our attention. We will be sure to include it soon.