2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-17 09:25:32 +00:00
cheat.sheets/sheets/apt-get

59 lines
2.3 KiB
Plaintext
Raw Normal View History

2020-03-10 17:36:31 +00:00
# apt-get
# Command-line interface to APT package management
# Update the local database of available packages, as discovered from package
# index file found in their sources. This does not actually update your
# installed software! For that, keeping reading.
apt-get update
2020-03-10 17:36:31 +00:00
# Upgrade installed packages, but there may be exceptions, such as important
# kernel packages. Also, packages will not be removed, like if they're
# deprecated, with this method.
apt-get upgrade
2020-03-10 17:36:31 +00:00
# Unlike the above, this will upgrade all of the installed packages, and
# perform other actions required for a successful and thorough upgrade. This
# will also allow for upgrading to the next minor release of your
# distributions, such as from Ubuntu '16.04.1' to '16.04.2'.
apt-get dist-upgrade
# Clean out (completely) the follow locations of saved DEB files:
#
# /var/cache/apt/archives/* /var/cache/apt/archives/partial/
# /var/lib/apt/lists/partial/
# /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
#
# This will also, thanks to the provided flag, be somewhat verbose.
2020-02-17 00:35:19 +00:00
apt-get clean -s
# View the changelog for the firefox package. Useful prior to or after upgrade.
apt-get changelog firefox
2020-03-10 17:36:31 +00:00
# Download PKG (one or more) without actually installing or extracting them. A
# good use for this might be to upgrade an offline system, by downloading the
# packages on a system using an Internet-able machine. Files are downloaded
# into the CWD.
apt-get download PKG
2020-03-10 17:36:31 +00:00
# Install PKG (one or more), bringing in dependencies and, provided settings
# allow it, install recommended and/or suggested packages.
apt-get install PKG
2020-03-10 17:36:31 +00:00
# At times, dependencies won't be installed, yet you still need them; the
# following command will often fix this, and is usually suggested to the user.
apt-get -f install
# Remove PKG, while also purging system-wide configuration files for it.
apt-get purge PKG
2020-03-10 17:36:31 +00:00
# Alternative syntax to the above.
apt-get remove --purge PKG
# Often used to first update the local database of packages, then, only if
# successful, a full system upgrade is started.
apt-get update && apt-get dist-upgrade
# Download specified package (firefox, in this example) and all packages marked
# thereby as important or dependencies. Files are downloaded into the CWD.
2020-03-10 17:36:31 +00:00
apt-get download firefox `apt-cache --important depends firefox |
awk '{if(NR>1){printf("%s ", $2)}}'`