apt-get

APT-GET Cheatsheet #

apt-get is a command-line tool for handling packages on Debian-based Linux distributions. It simplifies package management tasks such as installation, removal, and updates.

Basic Commands #

Command/OptionExampleDescription
apt-get install <package>apt-get install nginxInstall a package
apt-get remove <package>apt-get remove nginxRemove a package
apt-get purge <package>apt-get purge nginxRemove a package and its configuration files
apt-get updateapt-get updateUpdate the list of available packages and their versions
apt-get upgradeapt-get upgradeUpgrade all installed packages to the latest versions
apt-get dist-upgradeapt-get dist-upgradeUpgrade all installed packages and handle dependencies intelligently

Package Search and Info #

Command/OptionExampleDescription
apt-cache search <package>apt-cache search nginxSearch for packages by name or description
apt-cache show <package>apt-cache show nginxDisplay detailed information about a package
apt-cache policy <package>apt-cache policy nginxDisplay version and repository information about a package

Repository Management #

Command/OptionExampleDescription
add-apt-repository <repo>add-apt-repository ppa:nginx/stableAdd a new repository
apt-get updateapt-get updateUpdate package lists after adding a new repository
apt-get remove --purge <package>apt-get remove --purge add-apt-repositoryRemove the package that was used to add a repository

Cleaning and Caching #

Command/OptionExampleDescription
apt-get cleanapt-get cleanRemove all cached package files
apt-get autocleanapt-get autocleanRemove cached package files that can no longer be downloaded
apt-get autoremoveapt-get autoremoveRemove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed

Transaction and History #

Command/OptionExampleDescription
apt-get -f installapt-get -f installFix broken dependencies
dpkg --configure -adpkg --configure -aReconfigure unpacked packages that have not yet been configured

Miscellaneous #

Command/OptionExampleDescription
apt-get download <package>apt-get download nginxDownload a package file without installing it
dpkg -L <package>dpkg -L nginxList all files installed by a package
dpkg -S <file>dpkg -S /usr/sbin/nginxFind the package that owns a specific file

This cheatsheet covers essential apt-get commands and options for package management on Debian-based Linux distributions.

apt-get

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.